 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package tracing is responsible for forwarding and translating span headers for internal requests
Index ¶
- Constants
- func HTTPMiddleware(h http.Handler) http.Handler
- func HeaderMatcher(key string) (string, bool)
- func New(log Logger, service string, host string, zipkinEndpoint string) io.Closer
- func NewFromEnv(log Logger, service string, host string, endpointVar, disableVar string) io.Closer
- func NewSpanContext(ctx context.Context, operationName string) (opentracing.Span, context.Context)
- func NewTracer(log Logger, portName string) io.Closer
- func SetSpanField(ctx context.Context, key string, value string)
- func SetSpanHTTPHeader(span opentracing.Span, log Logger, r *http.Request)
- func StartSpanFromContext(ctx context.Context, name string, options ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
- func TraceIDFromContext(ctx context.Context) string
- type Logger
Constants ¶
const (
	TraceID = prefixTracerState + "traceid"
)
    Variables ¶
This section is empty.
Functions ¶
func HeaderMatcher ¶
HeaderMatcher ensures that open tracing headers x-b3-* are forwarded to output requests
func NewFromEnv ¶
NewFromEnv initialises tracing and returns a closer if tracing is configured. If the necessary configuration is not available it is Fatal unless disableVar is set and is truthy (strconf.ParseBool -> true). If tracing is disabled returns nil
func NewSpanContext ¶
func SetSpanField ¶ added in v0.27.0
func SetSpanHTTPHeader ¶ added in v0.27.0
func SetSpanHTTPHeader(span opentracing.Span, log Logger, r *http.Request)
func StartSpanFromContext ¶
func StartSpanFromContext(ctx context.Context, name string, options ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
StartSpanFromContext is a simple wrapper that removes the requirement to import "github.com/opentracing/opentracing-go" in business code.
func TraceIDFromContext ¶
Types ¶
type Logger ¶ added in v0.16.4
func LogFromContext ¶ added in v0.27.0
LogFromContext takes the trace ID from the current span and adds it to the logger:
returns:
- the new logger with a context metadata value for traceID
This will be called on entry to a method or a function that has a context.Context.