Documentation ¶
Overview ¶
Package tracing provides the means for creating traces and configuring trace exporters.
Index ¶
- Variables
- func ConfigureTraceProvider(tp trace.Provider)
- func End(span trace.Span, err error)
- func FromContext(ctx context.Context) trace.Span
- func Inject(ctx context.Context, supplier propagators.Supplier)
- func StartSpan(ctx context.Context, component string, attrs Attrs) (context.Context, trace.Span)
- func StartSpanFollowing(ctx context.Context, following WithSpanContext, component string, attrs Attrs) (context.Context, trace.Span)
- func StartSpanLinkedToFollowing(linked context.Context, following WithSpanContext, component string, ...) (context.Context, trace.Span)
- func TraceProvider(exporter export.SpanSyncer) trace.Provider
- type Attrs
- type Config
- type Jaeger
- type Stackdriver
- type TestTraceProvider
- type WithSpanContext
Constants ¶
This section is empty.
Variables ¶
var Configured bool
Configured indicates whether tracing has been configured or not.
This variable is needed in order to shortcircuit span generation when tracing hasn't been configured.
Functions ¶
func ConfigureTraceProvider ¶
ConfigureTraceProvider configures the sdk to use a given trace provider.
By default, a noop tracer is registered, thus, it's safe to call StartSpan and other related methods even before `ConfigureTracer` it called.
func StartSpan ¶
StartSpan creates a span, giving back a context that has itself added as the parent span.
Calls to this function with a context that has been generated from a previous call to this method will make the resulting span a child of the span that preceded it.
For instance:
``` func fn () {
rootCtx, rootSpan := StartSpan(context.Background(), "foo", nil) defer rootSpan.End() _, childSpan := StartSpan(rootCtx, "bar", nil) defer childSpan.End()
} ```
calling `fn()` will lead to the following trace:
``` foo 0--------3
bar 1----2
```
where (0) is the start of the root span, which then gets a child `bar` initializing at (1), having its end called (2), and then the last span finalization happening for the root span (3) given how `defer` statements stack.
func StartSpanFollowing ¶
func TraceProvider ¶
func TraceProvider(exporter export.SpanSyncer) trace.Provider
Types ¶
type Config ¶
type Config struct { Jaeger Jaeger Stackdriver Stackdriver }
type Jaeger ¶
type Jaeger struct { Endpoint string `long:"jaeger-endpoint" description:"jaeger http-based thrift collector"` Tags map[string]string `long:"jaeger-tags" description:"tags to add to the components"` Service string `long:"jaeger-service" description:"jaeger process service name" default:"web"` }
func (Jaeger) IsConfigured ¶
type Stackdriver ¶
type Stackdriver struct {
ProjectID string `long:"stackdriver-projectid" description:"GCP's Project ID"`
}
func (Stackdriver) Exporter ¶
func (s Stackdriver) Exporter() (export.SpanSyncer, error)
func (Stackdriver) IsConfigured ¶
func (s Stackdriver) IsConfigured() bool
type TestTraceProvider ¶
type TestTraceProvider struct {
// contains filtered or unexported fields
}
type WithSpanContext ¶
type WithSpanContext interface {
SpanContext() propagators.Supplier
}