Documentation
¶
Overview ¶
Package tracehttp traces outbound HTTP requests without recording what a URL may hide: every request is a client span of the caller's trace whose attributes are the method, the server's host and port and the response status, never the path or the query (a device token, a webhook secret, a signed link). The trace context stays local: no traceparent, tracestate or baggage goes out, since the destination is outside the installation (a user's URL, a push service). A destination that takes part in the trace gets it with WithPropagator. OpenTelemetry's otelhttp records the full URL and cannot be told not to.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v0.6.89
type Option func(*options)
Option configures NewTransport.
func WithPropagator ¶ added in v0.6.89
func WithPropagator(propagator propagation.TextMapPropagator) Option
WithPropagator sends the trace context with propagator, for a destination that takes part in the installation's trace; by default nothing is sent.
func WithTracerProvider ¶ added in v0.6.89
func WithTracerProvider(provider trace.TracerProvider) Option
WithTracerProvider makes the spans with provider instead of the global one.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport traces the requests of base.
func NewTransport ¶
func NewTransport(base http.RoundTripper, opts ...Option) *Transport
NewTransport is a Transport over base (http.DefaultTransport when nil).
func (*Transport) CloseIdleConnections ¶ added in v0.6.93
func (t *Transport) CloseIdleConnections()
CloseIdleConnections closes the base's idle connections when it keeps any (http.Client.CloseIdleConnections reaches the base through it).