-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
distribution: Pass Traceparent
OTEL header
#49156
Conversation
// TODO(dmcgowan): Call close idle connections when complete and use keep alive | ||
DisableKeepAlives: true, | ||
} | ||
return otelhttp.NewTransport( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw there's also a utility for this, not sure if that's better? (possibly it allows not having to import otelhttp
, but leave that to to the utility);
moby/vendor/github.com/containerd/containerd/tracing/tracing.go
Lines 51 to 59 in ad69293
// UpdateHTTPClient updates the http client with the necessary otel transport | |
func UpdateHTTPClient(client *http.Client, name string) { | |
client.Transport = otelhttp.NewTransport( | |
client.Transport, | |
otelhttp.WithSpanNameFormatter(func(operation string, r *http.Request) string { | |
return name | |
}), | |
) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is, but it takes an returns the whole http.Client
instead of a http.RoundTripper
so can't really use it
545b92b
to
ed39c51
Compare
Wrap `http.RoundTripper` used by distribution code (push/pull) with the `otelhttp.Transport`. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
ed39c51
to
93e9f7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM to align with the containerd implementation (which already passes through these headers).
Perhaps would be good to include this in a draft / test-PR in docker/cli to see if the new imports have any unwanted ripple effect w.r.t. dependencies.
Wrap
http.RoundTripper
used by distribution code (push/pull) with theotelhttp.Transport
.- How to verify it
OTEL_EXPORTER_OTLP_ENDPOINT
env-var)mitmdump -p 5050 -m reverse:<actual registry mirror> --flow-detail 2
docker pull <proxy>/<something>
Example:
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)