http_opentracing

package
v0.0.0-...-edc8019 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 9 Imported by: 5

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

View Source
const (
	TagTraceId = "trace.traceid"
	TagSpanId  = "trace.spanid"
	TagSampled = "trace.sampled"
)

Variables

This section is empty.

Functions

func DefaultStatusCodeIsError

func DefaultStatusCodeIsError(statusCode int) bool

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

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

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

type StatusCodeIsError func(statusCode int) bool

StatusCodeIsError allows the customization of which requests are considered errors in the tracing system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL