trace

package
v0.0.0-...-5ec3a36 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: Apache-2.0, UPL-1.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TraceHTTPHeader is the header that will be used to expose the trace ID.
	TraceHTTPHeader = "X-Wercker-Trace-Id"

	// TraceFieldKey is the key that will be used for the field key.
	TraceFieldKey = "traceID"
)

Variables

This section is empty.

Functions

func ExposeHandler

func ExposeHandler(h http.Handler) http.Handler

ExposeHandler decorates another http.Handler. It will check the context defined on the incoming http.Request for a traceID. If it is found it will add this to the response header and to the fields in the context.

func ExposeInterceptor

func ExposeInterceptor() grpc.UnaryServerInterceptor

ExposeInterceptor extracts the TraceID from the context and adds it to fields in the context.

func ExtractTraceID

func ExtractTraceID(ctx context.Context) string

ExtractTraceID extracts the TraceID from a opentracing enabled context. Currently only the zipkin implementation is supported. Returns an empty string when no opentracing span was found, or a unsupported implementation was used.

func HTTPMiddleware

func HTTPMiddleware(handler http.Handler, tracer opentracing.Tracer) http.Handler

HTTPMiddleware adds a opentracing middleware, and exposes the TraceID.

func Interceptor

func Interceptor(tracer opentracing.Tracer) grpc.UnaryServerInterceptor

Interceptor adds a opentracing middleware, and exposes the TraceID.

func NewNoopTracer

func NewNoopTracer() (opentracing.Tracer, error)

NewNoopTracer creates a Tracer which still uses the zipkin Tracer but none of the traces will be sampled. This still allows for a unique TraceID to be generated.

func NewZipkinTracer

func NewZipkinTracer(endpoint string, serviceName string, servicePort int) (opentracing.Tracer, error)

NewZipkinTracer creates a new Tracer which uses Zipkin as the backend store.

Types

This section is empty.

Jump to

Keyboard shortcuts

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