package httptrace
import "go.opencensus.io/plugin/http/httptrace"
Package httptrace contains OpenCensus tracing integrations with net/http.
Index ¶
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.
func (*Transport) RoundTrip ¶
RoundTrip creates a trace.Span and inserts it into the outgoing request's headers. The created span can follow a parent span, if a parent is presented in the request's context.
Source Files ¶
httptrace.go
- Version
- v0.2.0
- Published
- Jan 30, 2018
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 4 hours ago –
Tools for package owners.