Documentation
¶
Index ¶
- func Enabled() bool
- func FinishSpan(span trace.Span, err *error)
- func FormatTraceContext(spanCtx trace.SpanContext) (traceparent, tracestate string)
- func Initialize(ctx context.Context, endpoint string, insecure bool) error
- func ParseTraceContext(traceparent, tracestate string) (context.Context, error)
- func SetLeewayVersion(version string)
- func Shutdown(ctx context.Context) error
- func StartSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
- func Tracer() trace.Tracer
- func ValidateTraceParent(traceparent string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶ added in v0.19.0
func Enabled() bool
Enabled returns true if tracing has been initialized.
func FinishSpan ¶ added in v0.19.0
FinishSpan ends a span and sets its status based on the error. Usage: defer telemetry.FinishSpan(span, &err)
func FormatTraceContext ¶
func FormatTraceContext(spanCtx trace.SpanContext) (traceparent, tracestate string)
FormatTraceContext formats a span context into W3C Trace Context format.
func Initialize ¶ added in v0.19.0
Initialize sets up the OpenTelemetry tracer with OTLP HTTP exporter. This should be called once at application startup. Returns an error if initialization fails, or nil if tracing is disabled (empty endpoint).
func ParseTraceContext ¶
ParseTraceContext parses W3C Trace Context headers (traceparent and tracestate) and returns a context with the extracted trace information.
func SetLeewayVersion ¶
func SetLeewayVersion(version string)
SetLeewayVersion sets the leeway version for telemetry reporting
func StartSpan ¶ added in v0.19.0
func StartSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
StartSpan creates a new span with the given name and attributes.
func ValidateTraceParent ¶
ValidateTraceParent validates the format of a traceparent header.
Types ¶
This section is empty.