Documentation ¶
Overview ¶
Package httptrace contains OpenCensus tracing integrations with net/http.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(base http.Handler, format ...propagation.HTTPFormat) http.Handler
NewHandler returns a http.Handler from the given handler that is aware of the incoming request's span. The span can be extracted from the incoming request in handler functions from incoming request's context:
span := trace.FromContext(r.Context())
The span will be automatically ended by the handler.
Incoming propagation mechanism is determined by the given HTTP propagators.
Types ¶
type Transport ¶
type Transport struct { // Base represents the underlying roundtripper that does the actual requests. // If none is given, http.DefaultTransport is used. // // If base HTTP roundtripper implements CancelRequest, // the returned round tripper will be cancelable. Base http.RoundTripper // Formats are the mechanisms that propagate // the outgoing trace in an HTTP request. Formats []propagation.HTTPFormat }
Transport is an http.RoundTripper that traces the outgoing requests.
Use NewTransport to create new transports.
func NewTransport ¶
func NewTransport(format ...propagation.HTTPFormat) *Transport
NewTransport returns an http.RoundTripper that traces the outgoing requests.
Traces are propagated via the provided HTTP propagation mechanisms.
func (*Transport) CancelRequest ¶
CancelRequest cancels an in-flight request by closing its connection.