tracing

package
v0.0.0-...-f98d588 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(ctx *gin.Context) context.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.

Jump to

Keyboard shortcuts

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