Documentation
¶
Index ¶
- Variables
- func ExtractSampledTraceID(ctx context.Context) (string, bool)
- func ExtractTraceID(ctx context.Context) (string, bool)
- func ExtractTraceSpanID(ctx context.Context) (string, string, bool)
- func KeyValueToOTelAttribute(key string, val any) attribute.KeyValue
- func NewFromEnv(serviceName string, options ...jaegercfg.Option) (io.Closer, error)
- func NewOTelFromEnv(serviceName string, logger log.Logger, opts ...OTelOption) (io.Closer, error)
- func NewOTelFromJaegerEnv(serviceName string) (io.Closer, error)deprecated
- func NewOTelOrJaegerFromEnv(serviceName string, logger log.Logger, opts ...OTelOption) (io.Closer, error)
- func NewResource(serviceName string, customAttributes []attribute.KeyValue) (*resource.Resource, error)
- func OTelPropagatorsFromEnv() []propagation.TextMapPropagator
- func SpanFromContext(ctx context.Context) (otelSpan trace.Span, opentracingSpan opentracing.Span, sampled bool)
- type JaegerDebuggingPropagator
- type JaegerDebuggingSampler
- type OTelOption
- type Span
- type SpanKindRPCClient
- type SpanOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBlankJaegerTraceConfiguration is an error to notify client to provide valid trace report agent or config server. ErrBlankJaegerTraceConfiguration = errors.New("no Jaeger trace report agent, config server, or collector endpoint specified") )
Functions ¶
func ExtractSampledTraceID ¶
ExtractSampledTraceID works like ExtractTraceID but the returned bool is only true if the returned trace id is sampled.
func ExtractTraceID ¶
ExtractTraceID extracts the trace id, if any from the context.
func ExtractTraceSpanID ¶
ExtractTraceSpanID extracts the trace id, span id if any from the context.
func NewFromEnv ¶
NewFromEnv is a convenience function to allow tracing configuration via environment variables
Tracing will be enabled if one (or more) of the following environment variables is used to configure trace reporting: - JAEGER_AGENT_HOST - JAEGER_SAMPLER_MANAGER_HOST_PORT
func NewOTelFromEnv ¶
NewOTelFromEnv is a convenience function to allow OpenTelemetry tracing configuration via environment variables. Refer to official OTel SDK configuration docs to see the available options. https://opentelemetry.io/docs/languages/sdk-configuration/general/
func NewOTelFromJaegerEnv
deprecated
NewOTelFromJaegerEnv is a convenience function to allow OTel tracing configuration via Jaeger environment variables
Tracing will be enabled if one (or more) of the following environment variables is used to configure trace reporting: - JAEGER_AGENT_HOST - JAEGER_SAMPLER_MANAGER_HOST_PORT
Deprecated: use NewOTelOrJaegerFromEnv instead as it will automatically configure OTel auto exporter if Jaeger is not configured.
func NewOTelOrJaegerFromEnv ¶
func NewOTelOrJaegerFromEnv(serviceName string, logger log.Logger, opts ...OTelOption) (io.Closer, error)
NewOTelOrJaegerFromEnv is a convenience function to allow OTel tracing configuration via environment variables. It will configure Jaeger exporter if any of the following environment variables are set: - JAEGER_AGENT_HOST - JAEGER_ENDPOINT - JAEGER_SAMPLER_MANAGER_HOST_PORT
Otherwise, it will initialize tracing with the OTel auto exporter using the environment variables defined in the OTel docs. If you want to explicitly disable OTel auto exporter, you can set the environment variable `OTEL_TRACES_EXPORTER` to `none`.
func NewResource ¶
func NewResource(serviceName string, customAttributes []attribute.KeyValue) (*resource.Resource, error)
NewResource creates a new OpenTelemetry resource using the provided service name and custom attributes. This resource will be used for creating both tracers and meters, enriching telemetry data with context.
func OTelPropagatorsFromEnv ¶
func OTelPropagatorsFromEnv() []propagation.TextMapPropagator
OTelPropagatorsFromEnv returns a slice of OpenTelemetry TextMapPropagators based on the OTEL_PROPAGATORS environment variable. If the environment variable is not set, it defaults to using TraceContext, Baggage, and Jaeger propagators. This implementation supports only `tracecontext`, `baggage`, and `jaeger` and `none` propagators. See docs in: https://opentelemetry.io/docs/languages/sdk-configuration/general/
func SpanFromContext ¶
Types ¶
type JaegerDebuggingPropagator ¶
type JaegerDebuggingPropagator struct{}
func (JaegerDebuggingPropagator) Extract ¶
func (j JaegerDebuggingPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context
func (JaegerDebuggingPropagator) Fields ¶
func (j JaegerDebuggingPropagator) Fields() []string
func (JaegerDebuggingPropagator) Inject ¶
func (j JaegerDebuggingPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier)
type JaegerDebuggingSampler ¶
type JaegerDebuggingSampler struct {
// contains filtered or unexported fields
}
func (*JaegerDebuggingSampler) Description ¶
func (j *JaegerDebuggingSampler) Description() string
func (*JaegerDebuggingSampler) ShouldSample ¶
func (j *JaegerDebuggingSampler) ShouldSample(parameters tracesdk.SamplingParameters) tracesdk.SamplingResult
type OTelOption ¶
type OTelOption interface {
// contains filtered or unexported methods
}
func WithPyroscopeDisabled ¶
func WithPyroscopeDisabled() OTelOption
WithPyroscopeDisabled disables pyroscope profiling in the OpenTelemetry tracer.
func WithResourceAttributes ¶
func WithResourceAttributes(attrs ...attribute.KeyValue) OTelOption
WithResourceAttributes allows to add custom attributes to the OpenTelemetry resource. This is useful to set, for example, the service version. Service name is already set by default.
func WithTracerProviderOptions ¶
func WithTracerProviderOptions(opts ...tracesdk.TracerProviderOption) OTelOption
WithTracerProviderOptions allows to pass additional options to the OpenTelemetry TracerProvider.
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span is either an OpenTracing span or an OpenTelemetry span. It could also be a noop span.
func StartSpanFromContext ¶
func StartSpanFromContext(ctx context.Context, operation string, options ...SpanOption) (*Span, context.Context)
StartSpanFromContext starts a new opentracing span if opentracing is registered, otherwise it starts a new otel span.
type SpanKindRPCClient ¶
type SpanKindRPCClient struct{}
type SpanOption ¶
type SpanOption interface {
// contains filtered or unexported methods
}