Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Context ¶
Context returns the current tracing context for the request. If no span is set on the gin.Context it will return a context.Background().
func InitSpan ¶
func InitSpan(tracer opentracing.Tracer, operationName string, opts ...opentracing.StartSpanOption) gin.HandlerFunc
InitSpan initializes a new span. It tries to extract parent span from the HTTP headers of the request and will be initialized as a child span if it succeeds. Otherwise it will start a new span which is not a child.
func StartSpanFromContextWithTracer ¶
func StartSpanFromContextWithTracer(ctx context.Context, tracer opentracing.Tracer, operationName string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
StartSpanFromContextWithTracer starts and returns a Span with `operationName`, using any Span found within `ctx` as a ChildOfRef. If no such parent could be found, StartSpanFromContext creates a root (parentless) Span.
The second return value is a context.Context object built around the returned Span.
Example usage:
SomeFunction(ctx context.Context, tracer opentracing.Tracer, ...) { sp, ctx := opentracing.StartSpanFromContextWithTracer(ctx, tracer, "SomeFunction") defer sp.Finish() ... }
Types ¶
This section is empty.