Skip to content

Commit 34ab0d4

Browse files
committed
chore: Change environment variable conventions to match existing NodeJS auto-instrumentation and improve tests
Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
1 parent 67a9331 commit 34ab0d4

File tree

11 files changed

+261
-230
lines changed

11 files changed

+261
-230
lines changed

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,7 @@ check-embed: ## Verify that embedded files exist (required for tests)
218218
test: ## Run all tests (unit + integration + e2e)
219219
test: test-unit test-integration test-e2e
220220

221-
test-unit: test-unit/tool test-unit/pkg ## Run all unit tests (tool + pkg)
222-
@echo "Running pkg unit tests (semconv only - hook tests require full instrumentation)..."
223-
set -euo pipefail
224-
cd pkg/instrumentation/nethttp/semconv && go test -json -v -shuffle=on -timeout=5m -count=1 ./... 2>&1 | tee ../../../gotest-unit-pkg.log | gotestfmt
221+
test-unit: test-unit/tool test-unit/pkg test-unit/semconv ## Run all unit tests (tool + pkg)
225222

226223
.ONESHELL:
227224
test-unit/update-golden: ## Run unit tests and update golden files
@@ -234,6 +231,7 @@ test-unit/update-golden: package
234231
test-unit/coverage: ## Run unit tests with coverage report
235232
test-unit/coverage: package gotestfmt
236233
@echo "Running unit tests with coverage report..."
234+
237235
test-unit/tool: build package gotestfmt ## Run unit tests for tool modules only
238236
@echo "Running tool unit tests..."
239237
set -euo pipefail
@@ -249,6 +247,11 @@ test-unit/pkg: package gotestfmt ## Run unit tests for pkg modules only
249247
(cd $$moddir && go mod tidy && go test -json -v -shuffle=on -timeout=5m -count=1 ./... 2>&1 | tee -a ../../gotest-unit-pkg.log | gotestfmt); \
250248
done
251249

250+
test-unit/semconv: package gotestfmt ## Run unit tests for semconv modules only
251+
@echo "Running semconv unit tests..."
252+
set -euo pipefail
253+
go test -C pkg/instrumentation/nethttp/semconv -json -v -shuffle=on -timeout=5m -count=1 ./... 2>&1 | tee ./gotest-unit-semconv.log | gotestfmt
254+
252255
test-unit/coverage: test-unit/tool/coverage test-unit/pkg/coverage ## Run all unit tests with coverage
253256

254257
.ONESHELL:

docs/api-design-and-project-structure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ The instrumentation respects standard OpenTelemetry environment variables:
224224
- `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`: Metrics-specific endpoint
225225
- `OTEL_SERVICE_NAME`: Service name for telemetry
226226
- `OTEL_LOG_LEVEL`: Log level (`debug`, `info`, `warn`, `error`)
227-
- `OTEL_INSTRUMENTATION_ENABLED`: Global enable/disable flag (default: enabled)
228-
- `OTEL_INSTRUMENTATION_<NAME>_ENABLED`: Per-instrumentation enable/disable (e.g., `OTEL_INSTRUMENTATION_NETHTTP_ENABLED`)
227+
- `OTEL_GO_ENABLED_INSTRUMENTATIONS`: Comma-separated list of enabled instrumentations (e.g., `nethttp,grpc`)
228+
- `OTEL_GO_DISABLED_INSTRUMENTATIONS`: Comma-separated list of disabled instrumentations (e.g., `nethttp`)
229229

230230
## Adding New Instrumentation
231231

pkg/instrumentation/helloworld/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ replace github.com/open-telemetry/opentelemetry-go-compile-instrumentation/pkg =
77
require (
88
github.com/open-telemetry/opentelemetry-go-compile-instrumentation/pkg v0.0.0-20251125205614-8d1223fefdf3
99
go.opentelemetry.io/otel v1.38.0
10-
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.37.0
11-
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0
10+
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0
11+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0
1212
go.opentelemetry.io/otel/sdk v1.38.0
1313
go.opentelemetry.io/otel/sdk/metric v1.38.0
1414
go.opentelemetry.io/otel/trace v1.38.0

pkg/instrumentation/helloworld/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS
1717
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
1818
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
1919
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
20-
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.37.0 h1:6VjV6Et+1Hd2iLZEPtdV7vie80Yyqf7oikJLjQ/myi0=
21-
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.37.0/go.mod h1:u8hcp8ji5gaM/RfcOo8z9NMnf1pVLfVY7lBY2VOGuUU=
22-
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0 h1:SNhVp/9q4Go/XHBkQ1/d5u9P/U+L1yaGPoi0x+mStaI=
23-
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0/go.mod h1:tx8OOlGH6R4kLV67YaYO44GFXloEjGPZuMjEkaaqIp4=
20+
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0 h1:wm/Q0GAAykXv83wzcKzGGqAnnfLFyFe7RslekZuv+VI=
21+
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.38.0/go.mod h1:ra3Pa40+oKjvYh+ZD3EdxFZZB0xdMfuileHAm4nNN7w=
22+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0 h1:kJxSDN4SgWWTjG/hPp3O7LCGLcHXFlvS2/FFOrwL+SE=
23+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.38.0/go.mod h1:mgIOzS7iZeKJdeB8/NYHrJ48fdGc71Llo5bJ1J4DWUE=
2424
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
2525
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
2626
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=

pkg/instrumentation/nethttp/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ server_hook:
9898
Control instrumentation behavior at runtime:
9999
100100
```bash
101-
# Enable/disable net/http instrumentation
102-
export OTEL_INSTRUMENTATION_NETHTTP_ENABLED=true # default: true
101+
# Enable only specific instrumentations (comma-separated list)
102+
export OTEL_GO_ENABLED_INSTRUMENTATIONS=nethttp,grpc
103+
104+
# Disable specific instrumentations (comma-separated list)
105+
export OTEL_GO_DISABLED_INSTRUMENTATIONS=nethttp
103106

104107
# General OpenTelemetry configuration
105108
export OTEL_SERVICE_NAME=my-service
@@ -388,7 +391,10 @@ For a typical web request taking 10-100ms, instrumentation overhead is **< 0.01%
388391
**Check 1: Is instrumentation enabled?**
389392

390393
```bash
391-
export OTEL_INSTRUMENTATION_NETHTTP_ENABLED=true
394+
# Make sure nethttp is not in the disabled list
395+
unset OTEL_GO_DISABLED_INSTRUMENTATIONS
396+
# Or explicitly enable it
397+
export OTEL_GO_ENABLED_INSTRUMENTATIONS=nethttp
392398
```
393399

394400
**Check 2: Was the app built with the otel tool?**

pkg/instrumentation/nethttp/client/client_hook_test.go

Lines changed: 58 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,16 @@ func setupTestTracer() (*tracetest.SpanRecorder, *sdktrace.TracerProvider) {
100100
func TestBeforeRoundTrip(t *testing.T) {
101101
tests := []struct {
102102
name string
103-
setupEnv func()
103+
setupEnv func(t *testing.T)
104104
setupRequest func() *http.Request
105105
expectSpan bool
106106
validateSpan func(*testing.T, trace.Span)
107107
validateRequest func(*testing.T, *http.Request)
108108
}{
109109
{
110110
name: "basic request creates span",
111-
setupEnv: func() {
112-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
113-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
111+
setupEnv: func(t *testing.T) {
112+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
114113
},
115114
setupRequest: func() *http.Request {
116115
req, _ := http.NewRequest("GET", "http://example.com/path", nil)
@@ -127,8 +126,8 @@ func TestBeforeRoundTrip(t *testing.T) {
127126
},
128127
{
129128
name: "instrumentation disabled",
130-
setupEnv: func() {
131-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "false")
129+
setupEnv: func(t *testing.T) {
130+
t.Setenv("OTEL_GO_DISABLED_INSTRUMENTATIONS", "nethttp")
132131
},
133132
setupRequest: func() *http.Request {
134133
req, _ := http.NewRequest("GET", "http://example.com/path", nil)
@@ -138,9 +137,8 @@ func TestBeforeRoundTrip(t *testing.T) {
138137
},
139138
{
140139
name: "OTel exporter request filtered",
141-
setupEnv: func() {
142-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
143-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
140+
setupEnv: func(t *testing.T) {
141+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
144142
},
145143
setupRequest: func() *http.Request {
146144
req, _ := http.NewRequest("POST", "http://localhost:4318/v1/traces", nil)
@@ -151,9 +149,8 @@ func TestBeforeRoundTrip(t *testing.T) {
151149
},
152150
{
153151
name: "POST request",
154-
setupEnv: func() {
155-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
156-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
152+
setupEnv: func(t *testing.T) {
153+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
157154
},
158155
setupRequest: func() *http.Request {
159156
req, _ := http.NewRequest("POST", "http://example.com/api/data", nil)
@@ -163,9 +160,8 @@ func TestBeforeRoundTrip(t *testing.T) {
163160
},
164161
{
165162
name: "request with existing context",
166-
setupEnv: func() {
167-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
168-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
163+
setupEnv: func(t *testing.T) {
164+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
169165
},
170166
setupRequest: func() *http.Request {
171167
ctx := context.WithValue(context.Background(), "test-key", "test-value")
@@ -181,7 +177,7 @@ func TestBeforeRoundTrip(t *testing.T) {
181177
// Reset initialization for each test by creating a new once
182178
initOnce = *new(sync.Once)
183179

184-
tt.setupEnv()
180+
tt.setupEnv(t)
185181
sr, tp := setupTestTracer()
186182
defer tp.Shutdown(context.Background())
187183

@@ -229,21 +225,21 @@ func TestBeforeRoundTrip(t *testing.T) {
229225
func TestAfterRoundTrip(t *testing.T) {
230226
tests := []struct {
231227
name string
232-
setupEnv func()
233-
setupContext func(*tracetest.SpanRecorder) inst.HookContext
228+
setupEnv func(t *testing.T)
229+
setupContext func(*sdktrace.TracerProvider) inst.HookContext
234230
response *http.Response
235231
err error
236232
validateSpan func(*testing.T, []sdktrace.ReadOnlySpan)
237233
}{
238234
{
239235
name: "successful response",
240-
setupEnv: func() {
241-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
242-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
236+
setupEnv: func(t *testing.T) {
237+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
243238
},
244-
setupContext: func(sr *tracetest.SpanRecorder) inst.HookContext {
239+
setupContext: func(tp *sdktrace.TracerProvider) inst.HookContext {
240+
testTracer := tp.Tracer(instrumentationName)
245241
req, _ := http.NewRequest("GET", "http://example.com/path", nil)
246-
ctx, span := tracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
242+
ctx, span := testTracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
247243

248244
mockCtx := newMockHookContext()
249245
mockCtx.SetData(map[string]interface{}{
@@ -266,13 +262,13 @@ func TestAfterRoundTrip(t *testing.T) {
266262
},
267263
{
268264
name: "error response",
269-
setupEnv: func() {
270-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
271-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
265+
setupEnv: func(t *testing.T) {
266+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
272267
},
273-
setupContext: func(sr *tracetest.SpanRecorder) inst.HookContext {
268+
setupContext: func(tp *sdktrace.TracerProvider) inst.HookContext {
269+
testTracer := tp.Tracer(instrumentationName)
274270
req, _ := http.NewRequest("GET", "http://example.com/path", nil)
275-
ctx, span := tracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
271+
ctx, span := testTracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
276272

277273
mockCtx := newMockHookContext()
278274
mockCtx.SetData(map[string]interface{}{
@@ -298,13 +294,13 @@ func TestAfterRoundTrip(t *testing.T) {
298294
},
299295
{
300296
name: "4xx client error",
301-
setupEnv: func() {
302-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
303-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
297+
setupEnv: func(t *testing.T) {
298+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
304299
},
305-
setupContext: func(sr *tracetest.SpanRecorder) inst.HookContext {
300+
setupContext: func(tp *sdktrace.TracerProvider) inst.HookContext {
301+
testTracer := tp.Tracer(instrumentationName)
306302
req, _ := http.NewRequest("GET", "http://example.com/path", nil)
307-
ctx, span := tracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
303+
ctx, span := testTracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
308304

309305
mockCtx := newMockHookContext()
310306
mockCtx.SetData(map[string]interface{}{
@@ -322,19 +318,19 @@ func TestAfterRoundTrip(t *testing.T) {
322318
validateSpan: func(t *testing.T, spans []sdktrace.ReadOnlySpan) {
323319
require.Len(t, spans, 1)
324320
span := spans[0]
325-
// 4xx is not an error from OTel perspective
326-
assert.Equal(t, codes.Unset, span.Status().Code)
321+
// 4xx is an error for HTTP client requests per OTel HTTP semconv
322+
assert.Equal(t, codes.Error, span.Status().Code)
327323
},
328324
},
329325
{
330326
name: "5xx server error",
331-
setupEnv: func() {
332-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
333-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
327+
setupEnv: func(t *testing.T) {
328+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
334329
},
335-
setupContext: func(sr *tracetest.SpanRecorder) inst.HookContext {
330+
setupContext: func(tp *sdktrace.TracerProvider) inst.HookContext {
331+
testTracer := tp.Tracer(instrumentationName)
336332
req, _ := http.NewRequest("GET", "http://example.com/path", nil)
337-
ctx, span := tracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
333+
ctx, span := testTracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
338334

339335
mockCtx := newMockHookContext()
340336
mockCtx.SetData(map[string]interface{}{
@@ -357,11 +353,10 @@ func TestAfterRoundTrip(t *testing.T) {
357353
},
358354
{
359355
name: "no data in context",
360-
setupEnv: func() {
361-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
362-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
356+
setupEnv: func(t *testing.T) {
357+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
363358
},
364-
setupContext: func(sr *tracetest.SpanRecorder) inst.HookContext {
359+
setupContext: func(tp *sdktrace.TracerProvider) inst.HookContext {
365360
return newMockHookContext()
366361
},
367362
response: &http.Response{
@@ -376,12 +371,13 @@ func TestAfterRoundTrip(t *testing.T) {
376371
},
377372
{
378373
name: "instrumentation disabled",
379-
setupEnv: func() {
380-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "false")
374+
setupEnv: func(t *testing.T) {
375+
t.Setenv("OTEL_GO_DISABLED_INSTRUMENTATIONS", "nethttp")
381376
},
382-
setupContext: func(sr *tracetest.SpanRecorder) inst.HookContext {
377+
setupContext: func(tp *sdktrace.TracerProvider) inst.HookContext {
378+
testTracer := tp.Tracer(instrumentationName)
383379
req, _ := http.NewRequest("GET", "http://example.com/path", nil)
384-
ctx, span := tracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
380+
ctx, span := testTracer.Start(context.Background(), "GET", trace.WithSpanKind(trace.SpanKindClient))
385381

386382
mockCtx := newMockHookContext()
387383
mockCtx.SetData(map[string]interface{}{
@@ -408,11 +404,11 @@ func TestAfterRoundTrip(t *testing.T) {
408404
// Reset initialization for each test by creating a new once
409405
initOnce = *new(sync.Once)
410406

411-
tt.setupEnv()
407+
tt.setupEnv(t)
412408
sr, tp := setupTestTracer()
413409
defer tp.Shutdown(context.Background())
414410

415-
mockCtx := tt.setupContext(sr)
411+
mockCtx := tt.setupContext(tp)
416412

417413
AfterRoundTrip(mockCtx, tt.response, tt.err)
418414

@@ -427,44 +423,42 @@ func TestAfterRoundTrip(t *testing.T) {
427423
func TestClientEnabler(t *testing.T) {
428424
tests := []struct {
429425
name string
430-
setupEnv func()
426+
setupEnv func(t *testing.T)
431427
expected bool
432428
}{
433429
{
434430
name: "enabled explicitly",
435-
setupEnv: func() {
436-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
437-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "true")
431+
setupEnv: func(t *testing.T) {
432+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "nethttp")
438433
},
439434
expected: true,
440435
},
441436
{
442437
name: "disabled explicitly",
443-
setupEnv: func() {
444-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "false")
438+
setupEnv: func(t *testing.T) {
439+
t.Setenv("OTEL_GO_DISABLED_INSTRUMENTATIONS", "nethttp")
445440
},
446441
expected: false,
447442
},
448443
{
449-
name: "nethttp disabled",
450-
setupEnv: func() {
451-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
452-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_NETHTTP_ENABLED", "false")
444+
name: "not in enabled list",
445+
setupEnv: func(t *testing.T) {
446+
t.Setenv("OTEL_GO_ENABLED_INSTRUMENTATIONS", "grpc")
453447
},
454448
expected: false,
455449
},
456450
{
457-
name: "global enabled, nethttp not set",
458-
setupEnv: func() {
459-
t.Setenv("OTEL_GO_AUTO_INSTRUMENTATION_ENABLED", "true")
451+
name: "default enabled when no env set",
452+
setupEnv: func(t *testing.T) {
453+
// No environment variables set - should be enabled by default
460454
},
461455
expected: true,
462456
},
463457
}
464458

465459
for _, tt := range tests {
466460
t.Run(tt.name, func(t *testing.T) {
467-
tt.setupEnv()
461+
tt.setupEnv(t)
468462

469463
enabler := netHttpClientEnabler{}
470464
result := enabler.Enable()

pkg/instrumentation/nethttp/server/server_hook.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const (
2323
instrumentationVersion = "0.1.0"
2424
instrumentationKey = "NETHTTP"
2525
responseWriterIndex = 1
26+
requestIndex = 2
2627
)
2728

2829
var (
@@ -97,6 +98,10 @@ func BeforeServeHTTP(ictx inst.HookContext, recv interface{}, w http.ResponseWri
9798
}
9899
ictx.SetParam(responseWriterIndex, wrapper)
99100

101+
// Update request with new context containing the span
102+
newReq := r.WithContext(ctx)
103+
ictx.SetParam(requestIndex, newReq)
104+
100105
// Store data for after hook
101106
ictx.SetData(map[string]interface{}{
102107
"ctx": ctx,

0 commit comments

Comments
 (0)