Documentation ¶
Overview ¶
Package gintracing provides requests tracing functional using opentracing specification.
See https://github.com/opentracing/opentracing-go for more information
Index ¶
- Variables
- func NewSpan(tracer opentracing.Tracer, operationName string, ...) gin.HandlerFunc
- func SpanFromContext(tracer opentracing.Tracer, operationName string, ...) gin.HandlerFunc
- func SpanFromHeaders(tracer opentracing.Tracer, operationName string, psr ParentSpanReferenceFunc, ...) gin.HandlerFunc
- type ParentSpanReferenceFunc
Constants ¶
This section is empty.
Variables ¶
var AbortOnErrors = false
AbortOnErrors determines middleware behavior on errors. If set to true middleware aborts request with http.InternalServerError.
var ErrSpanNotFound = errors.New("span was not found in context")
Functions ¶
func NewSpan ¶
func NewSpan(tracer opentracing.Tracer, operationName string, opts ...opentracing.StartSpanOption) gin.HandlerFunc
NewSpan returns gin.HandlerFunc (middleware) that starts a new span and injects it to request context.
It calls ctx.Next() to measure execution time of all following handlers.
func SpanFromContext ¶
func SpanFromContext(tracer opentracing.Tracer, operationName string, advancedOpts ...opentracing.StartSpanOption) gin.HandlerFunc
SpanFromContext returns gin.HandlerFunc (middleware) that extracts parent span from request context and starts a new span as child of parent span.
It calls ctx.Next() to measure execution time of all following handlers.
func SpanFromHeaders ¶
func SpanFromHeaders(tracer opentracing.Tracer, operationName string, psr ParentSpanReferenceFunc, advancedOpts ...opentracing.StartSpanOption) gin.HandlerFunc
SpanFromHeaders returns gin.HandlerFunc (middleware) that extracts parent span data from HTTP headers and starts a new span referenced to parent with ParentSpanReferenceFunc.
It calls ctx.Next() to measure execution time of all following handlers.
Types ¶
type ParentSpanReferenceFunc ¶
type ParentSpanReferenceFunc func(opentracing.SpanContext) opentracing.StartSpanOption
ParentSpanReferenceFunc determines how to reference parent span
See opentracing.SpanReferenceType