package module
v0.3.0 Latest Latest

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 9 Imported by: 11



Package opentelemetry provides OpenTelemetry utilities.



This section is empty.


DefaultTextMapPropagator is the default OpenTelemetry TextMapPropagator used by this implementation if not otherwise set in TracerOptions.


func NewTracer

func NewTracer(options TracerOptions) (interceptor.Tracer, error)

NewTracer creates a tracer with the given options. Most callers should use NewTracingInterceptor instead.

func NewTracingInterceptor

func NewTracingInterceptor(options TracerOptions) (interceptor.Interceptor, error)

NewTracingInterceptor creates an interceptor for setting on client options that implements OpenTelemetry tracing for workflows.


type TracerOptions

type TracerOptions struct {
	// Tracer is the tracer to use. If not set, one is obtained from the global
	// tracer provider using the name "temporal-sdk-go".
	Tracer trace.Tracer

	// DisableSignalTracing can be set to disable signal tracing.
	DisableSignalTracing bool

	// DisableQueryTracing can be set to disable query tracing.
	DisableQueryTracing bool

	// AllowInvalidParentSpans will swallow errors interpreting parent
	// spans from headers. Useful when migrating from one tracing library
	// to another, while workflows/activities may be in progress.
	AllowInvalidParentSpans bool

	// TextMapPropagator is the propagator to use for serializing spans. If not
	// set, this uses DefaultTextMapPropagator, not the OpenTelemetry global one.
	// To use the OpenTelemetry global one, set this value to the result of the
	// global call.
	TextMapPropagator propagation.TextMapPropagator

	// SpanContextKey is the context key used for internal span tracking (not to
	// be confused with the context key OpenTelemetry uses internally). If not
	// set, this defaults to an internal key (recommended).
	SpanContextKey interface{}

	// HeaderKey is the Temporal header field key used to serialize spans. If
	// empty, this defaults to the one used by all SDKs (recommended).
	HeaderKey string

	// SpanStarter is a callback to create spans. If not set, this creates normal
	// OpenTelemetry spans calling Tracer.Start.
	SpanStarter func(ctx context.Context, t trace.Tracer, spanName string, opts ...trace.SpanStartOption) trace.Span

TracerOptions are options provided to NewTracingInterceptor or NewTracer.

Jump to

Keyboard shortcuts

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