Documentation ¶
Overview ¶
`http_opentracing` adds OpenTracing wares for HTTP libraries.
OpenTracing Wares ¶
These are both client-side and server-side wares for OpenTracing. They are a provider-agnostic, with backends such as Zipkin, or Google Stackdriver Trace.
For a service that sends out requests and receives requests, you *need* to use both, otherwise downstream requests will not have the appropriate requests propagated.
All server-side spans are tagged with http_ctxtags information.
For more information see: http://opentracing.io/documentation/ https://github.com/opentracing/specification/blob/master/semantic_conventions.md
Index ¶
Constants ¶
const ( TagTraceId = "trace.traceid" TagSpanId = "trace.spanid" )
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(opts ...Option) httpwares.Middleware
Middleware returns a http.Handler middleware values for request tags.
func Tripperware ¶
func Tripperware(opts ...Option) httpwares.Tripperware
Tripperware returns a piece of client-side Tripperware that forwards opentracing tokens.
Types ¶
type FilterFunc ¶
FilterFunc allows users to provide a function that filters out certain methods from being traced.
If it returns false, the given request will not be traced.
type Option ¶
type Option func(*options)
func WithFilterFunc ¶
func WithFilterFunc(f FilterFunc) Option
WithFilterFunc customizes the function used for deciding whether a given call is traced or not.
func WithStatusCodeIsError ¶
func WithStatusCodeIsError(f StatusCodeIsError) Option
WithStatusCodeIsError customizes the function used for deciding whether a given call was an error
func WithTracer ¶
func WithTracer(tracer opentracing.Tracer) Option
WithTracer sets a custom tracer to be used for this middleware, otherwise the opentracing.GlobalTracer is used.
type StatusCodeIsError ¶
StatusCodeIsError allows the customization of which requests are considered errors in the tracing system.