tracer

package
v0.0.0-...-844d4e4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTraceIDFromContext

func GetTraceIDFromContext(ctx context.Context) string

GetTraceIDFromContext return the trace ID from the context

func NewTracer

func NewTracer(config config.AppConfig) (Tracer, *Provider, func() error, error)

NewTracer initialises the OpenTelemetry tracer.

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

SpanFromContext returns the current Span from ctx.

If no Span is currently set in ctx an implementation of a Span that performs no operations is returned.

Types

type Option

type Option struct {
	trace.TracerOption
}

Option is wraps up trace.Option and applies an option to a TracerConfig.

type Provider

type Provider struct {
	*sdktrace.TracerProvider
}

Provider provides access to instrumentation Tracers.

func NewTracerProvider

func NewTracerProvider(c *ProviderConfig) (*Provider, func() error, error)

NewTracerProvider initializes the provider for OpenTelemetry traces.

type ProviderConfig

type ProviderConfig struct {
	// ServiceName indicates the service name to trace.
	ServiceName string

	// CollectorAddress indicates the collector's address.
	CollectorAddress string

	// CollectorBasicAuthCreds indicates the collector's basic auth credentials.
	CollectorBasicAuthCreds string

	// CollectorConnectTimeout indicate the duration to timeout when connecting to the collector.
	// By default, it is 5 * time.Second.
	CollectorConnectTimeout time.Duration
}

ProviderConfig indicates how the OpenTelemetry tracer provider should be initialised.

type Span

type Span struct {
	trace.Span
}

Span wraps up trace.Span which is the individual component of a trace. It represents a single named and timed operation of a workflow that is traced. A Tracer is used to create a Span and it is then up to the operation the Span represents to properly end the Span when the operation itself ends.

type Tracer

type Tracer struct {
	trace.Tracer
}

Tracer wraps up trace.Tracer which is the creator of Spans.

Jump to

Keyboard shortcuts

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