tracing

package
v1.7.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EntryPointMaxLengthNumber = 21

EntryPointMaxLengthNumber defines the number of static characters in the Entrypoint Span Trace name : 11 chars for 'Entrypoint ' + 8 chars for hash + 2 chars for '_'.

View Source
const ForwardMaxLengthNumber = 18

ForwardMaxLengthNumber defines the number of static characters in the Forwarding Span Trace name : 8 chars for 'forward ' + 8 chars for hash + 2 chars for '_'.

View Source
const TraceNameHashLength = 8

TraceNameHashLength defines the number of characters to use from the head of the generated hash.

Variables

This section is empty.

Functions

func GetSpan

func GetSpan(r *http.Request) opentracing.Span

GetSpan used to retrieve span from request context

func InjectRequestHeaders

func InjectRequestHeaders(r *http.Request)

InjectRequestHeaders used to inject OpenTracing headers into the request

func LogEventf

func LogEventf(r *http.Request, format string, args ...interface{})

LogEventf logs an event to the span in the request context.

func LogRequest

func LogRequest(span opentracing.Span, r *http.Request)

LogRequest used to create span tags from the request

func LogResponseCode

func LogResponseCode(span opentracing.Span, code int)

LogResponseCode used to log response code in span

func SetError

func SetError(r *http.Request)

SetError flags the span associated with this request as in error

func SetErrorAndDebugLog

func SetErrorAndDebugLog(r *http.Request, format string, args ...interface{})

SetErrorAndDebugLog flags the span associated with this request as in error and create a debug log.

func SetErrorAndWarnLog

func SetErrorAndWarnLog(r *http.Request, format string, args ...interface{})

SetErrorAndWarnLog flags the span associated with this request as in error and create a debug log.

func StartSpan

func StartSpan(r *http.Request, operationName string, spanKinClient bool, opts ...opentracing.StartSpanOption) (opentracing.Span, *http.Request, func())

StartSpan starts a new span from the one in the request context

Types

type Backend

type Backend interface {
	Setup(serviceName string) (opentracing.Tracer, io.Closer, error)
}

Backend describes things we can use to setup tracing

type HTTPHandlerWrapper

type HTTPHandlerWrapper struct {
	// contains filtered or unexported fields
}

HTTPHandlerWrapper is used to wrap http handler middleware

func (*HTTPHandlerWrapper) ServeHTTP

func (t *HTTPHandlerWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type HTTPHeadersCarrier added in v1.7.0

type HTTPHeadersCarrier http.Header

HTTPHeadersCarrier custom implementation to fix duplicated headers It has been fixed in https://github.com/opentracing/opentracing-go/pull/191

func (HTTPHeadersCarrier) ForeachKey added in v1.7.0

func (c HTTPHeadersCarrier) ForeachKey(handler func(key, val string) error) error

ForeachKey conforms to the TextMapReader interface.

func (HTTPHeadersCarrier) Set added in v1.7.0

func (c HTTPHeadersCarrier) Set(key, val string)

Set conforms to the TextMapWriter interface.

type NegroniHandlerWrapper

type NegroniHandlerWrapper struct {
	// contains filtered or unexported fields
}

NegroniHandlerWrapper is used to wrap negroni handler middleware

func (*NegroniHandlerWrapper) ServeHTTP

type Tracing

type Tracing struct {
	Backend       string          `description:"Selects the tracking backend ('jaeger','zipkin', 'datadog')." export:"true"`
	ServiceName   string          `description:"Set the name for this service" export:"true"`
	SpanNameLimit int             `description:"Set the maximum character limit for Span names (default 0 = no limit)" export:"true"`
	Jaeger        *jaeger.Config  `description:"Settings for jaeger"`
	Zipkin        *zipkin.Config  `description:"Settings for zipkin"`
	DataDog       *datadog.Config `description:"Settings for DataDog"`
	// contains filtered or unexported fields
}

Tracing middleware

func (*Tracing) Close

func (t *Tracing) Close()

Close tracer

func (*Tracing) Extract

func (t *Tracing) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)

Extract delegates to opentracing.Tracer

func (*Tracing) Inject

func (t *Tracing) Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error

Inject delegates to opentracing.Tracer

func (*Tracing) IsEnabled

func (t *Tracing) IsEnabled() bool

IsEnabled determines if tracing was successfully activated

func (*Tracing) NewEntryPoint

func (t *Tracing) NewEntryPoint(name string) negroni.Handler

NewEntryPoint creates a new middleware that the incoming request

func (*Tracing) NewForwarderMiddleware

func (t *Tracing) NewForwarderMiddleware(frontend, backend string) negroni.Handler

NewForwarderMiddleware creates a new forwarder middleware that traces the outgoing request

func (*Tracing) NewHTTPHandlerWrapper

func (t *Tracing) NewHTTPHandlerWrapper(name string, handler http.Handler, clientSpanKind bool) http.Handler

NewHTTPHandlerWrapper return a http.Handler struct

func (*Tracing) NewNegroniHandlerWrapper

func (t *Tracing) NewNegroniHandlerWrapper(name string, handler negroni.Handler, clientSpanKind bool) negroni.Handler

NewNegroniHandlerWrapper return a negroni.Handler struct

func (*Tracing) Setup

func (t *Tracing) Setup()

Setup Tracing middleware

func (*Tracing) StartSpan

func (t *Tracing) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span

StartSpan delegates to opentracing.Tracer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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