tracing

package
v1.7.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 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"`
	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