trace

package
v0.0.0-...-c18a219 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PkgName = "auxo.apm.trace"

	Binary      = opentracing.Binary
	TextMap     = opentracing.TextMap
	HTTPHeaders = opentracing.HTTPHeaders
)

Variables

This section is empty.

Functions

func ContextWithSpan

func ContextWithSpan(ctx context.Context, span opentracing.Span) context.Context

func Extract

func Extract(format, carrier interface{}) opentracing.SpanContext

func Inject

func Inject(sc opentracing.SpanContext, format, carrier interface{})

func SetTracer

func SetTracer(t opentracing.Tracer)

func SpanFromContext

func SpanFromContext(ctx context.Context) opentracing.Span

func StartChild

func StartChild(parent opentracing.Span, operation string) (span opentracing.Span)

func StartChildFromContext

func StartChildFromContext(ctx context.Context, operation string, opts ...opentracing.StartSpanOption) (span opentracing.Span)

StartChildFromContext starts and returns a Span with `operation`, using any Span found within `ctx` as a ChildOfRef. If no such parent could be found, StartChildFromContext creates a root (parentless) Span.

Example usage:

SomeFunction(ctx context.Context, ...) {
    sp := trace.StartChildFromContext(ctx, "SomeFunction")
    defer sp.Finish()
    ...
}

func StartFollow

func StartFollow(follow opentracing.Span, operation string) (span opentracing.Span)

func StartServer

func StartServer(operation string, format, carrier interface{}) opentracing.Span

StartServer extracts SpanContext from carrier, then starts and returns a server Span with `operation`, using any Span found within `SpanContext` as a ChildOfRef. If no such parent could be found, StartChildFromContext creates a root (parentless) Span.

Example usage:

SomeFunction(ctx context.Context, ...) {
    sp := trace.StartServer("SomeFunction", trace.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header))
    defer sp.Finish()
    ...
}

func StartSpan

func StartSpan(operation string, opts ...opentracing.StartSpanOption) opentracing.Span

Types

type HTTPHeadersCarrier

type HTTPHeadersCarrier = opentracing.HTTPHeadersCarrier

type Span

type Span = opentracing.Span

type StartSpanOption

type StartSpanOption = opentracing.StartSpanOption

type TextMapCarrier

type TextMapCarrier = opentracing.TextMapCarrier

type Tracer

type Tracer struct {
	opentracing.Tracer
	// contains filtered or unexported fields
}

func GetTracer

func GetTracer() *Tracer

func NewTracer

func NewTracer(tracer opentracing.Tracer) *Tracer

func (*Tracer) Extract

func (t *Tracer) Extract(format, carrier interface{}) opentracing.SpanContext

Extract() returns a SpanContext instance given `format` and `carrier`. If there was simply no SpanContext to extract or errors occurred, Extract() returns nil.

func (*Tracer) Inject

func (t *Tracer) Inject(sc opentracing.SpanContext, format, carrier interface{})

func (*Tracer) StartChild

func (t *Tracer) StartChild(parent opentracing.Span, operation string) opentracing.Span

func (*Tracer) StartChildFromContext

func (t *Tracer) StartChildFromContext(ctx context.Context, operation string, opts ...opentracing.StartSpanOption) opentracing.Span

StartChildFromContext starts and returns a Span with `operation`, using any Span found within `ctx` as a ChildOfRef. If no such parent could be found, StartChildFromContext creates a root (parentless) Span.

Example usage:

SomeFunction(ctx context.Context, ...) {
    sp := trace.StartChildFromContext(ctx, "SomeFunction")
    defer sp.Finish()
    ...
}

func (*Tracer) StartFollow

func (t *Tracer) StartFollow(follow opentracing.Span, operation string) opentracing.Span

func (*Tracer) StartServer

func (t *Tracer) StartServer(operation string, format, carrier interface{}) opentracing.Span

StartServer extracts SpanContext from carrier, then starts and returns a server Span with `operation`, using any Span found within `SpanContext` as a ChildOfRef. If no such parent could be found, StartChildFromContext creates a root (parentless) Span.

Example usage:

SomeFunction(ctx context.Context, ...) {
    sp := trace.StartServer("SomeFunction", trace.HTTPHeaders, opentracing.HTTPHeadersCarrier(r.Header))
    defer sp.Finish()
    ...
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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