package
1.12.1
Repository: https://github.com/contiamo/go-base.git
Documentation: pkg.go.dev

# Functions

GetSpanID extracts the span ID from the opentracing Span.
GetTraceID extracts the span ID from the opentracing Span.
InitJaeger asserts that the global tracer is initialized.
NewTracer create a new tracer that contains implementation for all tracing-related actions.
NewTracerWithLogs create a new tracer that contains logs spans to stdout as well as to the opentracing tracer.

# Interfaces

Tracer contains all the tracing-related functions for any module of the server that uses tracing Normally, if you have a module that needs tracing you embed the Tracer as following: type Some struct { tracing.Tracer } And then initialize the tracer when you initialize the module: func NewSome() Some { return Some{ Tracer: tracing.NewTracer("package", "Some"), } } To use the tracing capabilities you use it as following: func (s Some) Foo(ctx context.Context) (err error) { span, ctx := s.StartSpan(ctx, "Foo") // since the err is not assigned yet we have to take it into the closure defer func() { s.FinishSpan(span, err) }() span.SetTag("something", "important") ..