Documentation ¶
Overview ¶
Package opentelemetry provides OpenTelemetry utilities.
Index ¶
- Variables
- func NewTracer(options TracerOptions) (interceptor.Tracer, error)
- func NewTracingInterceptor(options TracerOptions) (interceptor.Interceptor, error)
- type MetricsHandler
- func (m MetricsHandler) Counter(name string) client.MetricsCounter
- func (m MetricsHandler) Gauge(name string) client.MetricsGauge
- func (m MetricsHandler) GetAttributes() attribute.Set
- func (m MetricsHandler) GetMeter() metric.Meter
- func (m MetricsHandler) Timer(name string) client.MetricsTimer
- func (m MetricsHandler) WithTags(tags map[string]string) client.MetricsHandler
- type MetricsHandlerOptions
- type TracerOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultTextMapPropagator = propagation.NewCompositeTextMapPropagator( propagation.TraceContext{}, propagation.Baggage{}, )
DefaultTextMapPropagator is the default OpenTelemetry TextMapPropagator used by this implementation if not otherwise set in TracerOptions.
Functions ¶
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.
Types ¶
type MetricsHandler ¶ added in v0.4.0
type MetricsHandler struct {
// contains filtered or unexported fields
}
MetricsHandler is an implementation of client.MetricsHandler for open telemetry.
func ExtractMetricsHandler ¶ added in v0.4.0
func ExtractMetricsHandler(handler client.MetricsHandler) *MetricsHandler
ExtractMetricsHandler gets the underlying Open Telemetry MetricsHandler from a MetricsHandler if any is present.
Raw use of the MetricHandler is discouraged but may be used for Histograms or other advanced features. This scope does not skip metrics during replay like the metrics handler does. Therefore the caller should check replay state.
func NewMetricsHandler ¶ added in v0.4.0
func NewMetricsHandler(options MetricsHandlerOptions) MetricsHandler
NewMetricsHandler returns a client.MetricsHandler that is backed by the given Meter
func (MetricsHandler) Counter ¶ added in v0.4.0
func (m MetricsHandler) Counter(name string) client.MetricsCounter
func (MetricsHandler) Gauge ¶ added in v0.4.0
func (m MetricsHandler) Gauge(name string) client.MetricsGauge
func (MetricsHandler) GetAttributes ¶ added in v0.4.0
func (m MetricsHandler) GetAttributes() attribute.Set
GetAttributes returns the attributes set on this handler.
func (MetricsHandler) GetMeter ¶ added in v0.4.0
func (m MetricsHandler) GetMeter() metric.Meter
GetMeter returns the meter used by this handler.
func (MetricsHandler) Timer ¶ added in v0.4.0
func (m MetricsHandler) Timer(name string) client.MetricsTimer
func (MetricsHandler) WithTags ¶ added in v0.4.0
func (m MetricsHandler) WithTags(tags map[string]string) client.MetricsHandler
type MetricsHandlerOptions ¶ added in v0.4.0
type MetricsHandlerOptions struct { // Meter is the Meter to use. If not set, one is obtained from the global // meter provider using the name "temporal-sdk-go". Meter metric.Meter // InitialAttributes to set on the handler // Optional: Defaults to the empty set. InitialAttributes attribute.Set // OnError Callback to invoke if the provided meter returns an error. // Optional: Defaults to panicking on any error. OnError func(error) }
MetricsHandlerOptions are options provided to NewMetricsHandler.
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 // DisableBaggage can be set to disable baggage propagation. DisableBaggage 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.