Documentation ¶
Overview ¶
Package http contains several http middlewares which can be used for instrumenting calls with Zipkin.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrValidTracerRequired = errors.New("valid tracer required")
ErrValidTracerRequired error
Functions ¶
func NewServerMiddleware ¶
NewServerMiddleware returns a http.Handler middleware with Zipkin tracing.
func NewTransport ¶
func NewTransport(tracer *zipkin.Tracer, options ...TransportOption) (http.RoundTripper, error)
NewTransport returns a new Zipkin instrumented http RoundTripper which can be used with a standard library http Client.
Types ¶
type Client ¶
Client holds a Zipkin instrumented HTTP Client.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption allows optional configuration of Client.
func ClientTags ¶
func ClientTags(tags map[string]string) ClientOption
ClientTags adds default Tags to inject into client application spans.
func ClientTrace ¶
func ClientTrace(enabled bool) ClientOption
ClientTrace allows one to enable Go's net/http/httptrace.
func TransportOptions ¶
func TransportOptions(options ...TransportOption) ClientOption
TransportOptions passes optional Transport configuration to the internal transport used by Client.
func WithClient ¶
func WithClient(client *http.Client) ClientOption
WithClient allows one to add a custom configured http.Client to use.
type ServerOption ¶
type ServerOption func(*handler)
ServerOption allows Middleware to be optionally configured.
func RequestSampler ¶ added in v0.1.1
func RequestSampler(sampleFunc func(r *http.Request) bool) ServerOption
RequestSampler allows one to set the sampling decision based on the details found in the http.Request.
func ServerTags ¶
func ServerTags(tags map[string]string) ServerOption
ServerTags adds default Tags to inject into server spans.
func SpanName ¶
func SpanName(name string) ServerOption
SpanName sets the name of the spans the middleware creates. Use this if wrapping each endpoint with its own Middleware. If omitting the SpanName option, the middleware will use the http request method as span name.
func TagResponseSize ¶
func TagResponseSize(enabled bool) ServerOption
TagResponseSize will instruct the middleware to Tag the http response size in the server side span.
type TransportOption ¶
type TransportOption func(*transport)
TransportOption allows one to configure optional transport configuration.
func RoundTripper ¶
func RoundTripper(rt http.RoundTripper) TransportOption
RoundTripper adds the Transport RoundTripper to wrap.
func TransportTags ¶
func TransportTags(tags map[string]string) TransportOption
TransportTags adds default Tags to inject into transport spans.
func TransportTrace ¶
func TransportTrace(enable bool) TransportOption
TransportTrace allows one to enable Go's net/http/httptrace.