import "github.com/improbable-eng/go-httpwares/tracing/opentracing"
http_opentracing
adds OpenTracing wares for HTTP libraries.
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
- github.com/improbable-eng/go-httpwares
- github.com/improbable-eng/go-httpwares/tags
- github.com/opentracing/opentracing-go
- github.com/opentracing/opentracing-go/ext
- github.com/opentracing/opentracing-go/log
- Constants
- func DefaultStatusCodeIsError(statusCode int) bool
- func Middleware(opts ...Option) httpwares.Middleware
- func Tripperware(opts ...Option) httpwares.Tripperware
- type FilterFunc
- type Option
- type StatusCodeIsError
doc.go id_extract.go middleware.go options.go tripperware.go
const (
TagTraceId = "trace.traceid"
TagSpanId = "trace.spanid"
)
func DefaultStatusCodeIsError(statusCode int) bool
func Middleware(opts ...Option) httpwares.Middleware
Middleware returns a http.Handler middleware values for request tags.
func Tripperware(opts ...Option) httpwares.Tripperware
Tripperware returns a piece of client-side Tripperware that forwards opentracing tokens.
type FilterFunc func(req *http.Request) bool
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 func(*options)
func WithFilterFunc(f FilterFunc) Option
WithFilterFunc customizes the function used for deciding whether a given call is traced or not.
func WithStatusCodeIsError(f StatusCodeIsError) Option
WithStatusCodeIsError customizes the function used for deciding whether a given call was an error
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 func(statusCode int) bool
StatusCodeIsError allows the customization of which requests are considered errors in the tracing system.
Generated by godoc2ghmd