instrumentation/net/http/httptrace/otelhttptrace/api.go
raw| 1 | // Copyright The OpenTelemetry Authors |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | package otelhttptrace // import "go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace" |
| 5 | |
| 6 | import ( |
| 7 | "context" |
| 8 | "net/http" |
| 9 | "net/http/httptrace" |
| 10 | ) |
| 11 | |
| 12 | // W3C client. |
| 13 | func W3C(ctx context.Context, req *http.Request) (context.Context, *http.Request) { |
| 14 | ctx = httptrace.WithClientTrace(ctx, NewClientTrace(ctx)) |
| 15 | req = req.WithContext(ctx) |
| 16 | return ctx, req |
| 17 | } |