Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TracerProvider ¶ added in v0.0.4
type TracerProvider struct {
Provider *tracesdk.TracerProvider
}
TracerProvider holds the state for a provider, and provides an easy way to shut it down without exposing the specific type of tracer returned.
func NewTracerProvider ¶
func NewTracerProvider(ctx context.Context, otlpEndpoint string, traceToStdout bool, githash string, appname string, traceRatio float64) (*TracerProvider, error)
NewTracerProvider returns an OpenTelemetry TracerProvider configured to use the Jaeger exporter that will send spans to the provided url. The returned TracerProvider will also use a Resource configured with all the information about the application.
If no error is returned, `defer provider.Shutdown(ctx)` should be set up to ensure flushing occurs.
If the otlpEndpoint URL is empty, the OpenTelemetry TracerProvider will be configured to not report to an external tracer.
If traceToStdout is true, traces will be sent to stdout.
func (*TracerProvider) Shutdown ¶ added in v0.0.4
func (p *TracerProvider) Shutdown(ctx context.Context)
Shutdown should be deferred immediately after NewTracerProvider() when no error is returned. This will ensure that on app termination it will flush any buffered traces, if possible. A maximum time of 5 seconds will be allowed before we give up, to prevent a hang at shutdown.