Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitJaeger ¶
InitJaeger asserts that the global tracer is initialized.
This will read the configuration from the "JAEGER_*"" environment variables. Overriding the empty values with the supplied app value. If a sampler type is not configured via the environment variables, then InitJaeger will be configured with the constant sampler.
Types ¶
type Tracer ¶ added in v1.0.0
type Tracer interface {
StartSpan(ctx context.Context, operationName string) (opentracing.Span, context.Context)
FinishSpan(opentracing.Span, error)
}
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")
...
}
Click to show internal directories.
Click to hide internal directories.