mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Wrap `http.RoundTripper` used by distribution code (push/pull) with the `otelhttp.Transport`. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
19 lines
569 B
Go
19 lines
569 B
Go
package distribution
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/docker/distribution/registry/client/transport"
|
|
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
|
)
|
|
|
|
// newTransport creates a new transport which will apply modifiers to
|
|
// the request on a RoundTrip call.
|
|
func newTransport(base http.RoundTripper, modifiers ...transport.RequestModifier) http.RoundTripper {
|
|
tr := transport.NewTransport(base, modifiers...)
|
|
|
|
// Wrap the transport with OpenTelemetry instrumentation
|
|
// This propagates the Traceparent header.
|
|
return otelhttp.NewTransport(tr)
|
|
}
|