Documentation
¶
Overview ¶
Package otel provides OpenTelemetry tracing integration using OTLP exporters.
Note: This package was originally designed for Jaeger integration, but since OpenTelemetry dropped support for the Jaeger exporter in July 2023, it now uses OTLP (OpenTelemetry Protocol) exporters instead. Jaeger officially accepts and recommends using OTLP for sending traces.
Supported exporter types:
- otlp-http: OTLP over HTTP (recommended for most use cases)
- otlp-grpc: OTLP over gRPC (for high-performance scenarios)
The package maintains backward compatibility by keeping the same configuration structure and API, but internally uses OTLP exporters to send traces to Jaeger or other OTLP-compatible backends like Uptrace.
Index ¶
- Variables
- func AddSpanEvent(span trace.Span, name string, attrs ...attribute.KeyValue)
- func AddSpanTags(span trace.Span, tags map[string]any)
- func Close() error
- func GetTracer() trace.Tracer
- func Init() error
- func IsEnabled() bool
- func RecordError(span trace.Span, err error)
- func SpanFromContext(ctx context.Context) trace.Span
- func StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
Constants ¶
This section is empty.
Variables ¶
var (
ErrOTELIsDisabled = errors.New("otel is disabled")
)
Functions ¶
func AddSpanEvent ¶
AddSpanEvent adds an event to the current span
func AddSpanTags ¶
AddSpanTags adds tags to the current span
func Init ¶
func Init() error
Init initializes the OpenTelemetry tracer with OTLP exporters. This function replaces the deprecated Jaeger exporter with OTLP exporters that are compatible with Jaeger and other tracing backends.
func RecordError ¶
RecordError records an error in the current span
func SpanFromContext ¶
SpanFromContext returns the span from the context
Types ¶
This section is empty.