Documentation
¶
Index ¶
- func FormatTraceContext(spanCtx trace.SpanContext) (traceparent, tracestate string)
- func InitTracer(ctx context.Context, endpoint string, insecure bool) (*sdktrace.TracerProvider, error)
- func ParseTraceContext(traceparent, tracestate string) (context.Context, error)
- func SetLeewayVersion(version string)
- func Shutdown(ctx context.Context, tp *sdktrace.TracerProvider) error
- func ValidateTraceParent(traceparent string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatTraceContext ¶
func FormatTraceContext(spanCtx trace.SpanContext) (traceparent, tracestate string)
FormatTraceContext formats a span context into W3C Trace Context format. This is useful for propagating trace context to child processes.
func InitTracer ¶
func InitTracer(ctx context.Context, endpoint string, insecure bool) (*sdktrace.TracerProvider, error)
InitTracer initializes the OpenTelemetry tracer with OTLP HTTP exporter. The endpoint parameter specifies the OTLP endpoint URL (e.g., "localhost:4318"). The insecure parameter controls whether to use TLS (false = use TLS, true = no TLS). Returns the TracerProvider which must be shut down when done.
func ParseTraceContext ¶
ParseTraceContext parses W3C Trace Context headers (traceparent and tracestate) and returns a context with the extracted trace information. Format: traceparent = "00-{trace-id}-{span-id}-{flags}"
func SetLeewayVersion ¶
func SetLeewayVersion(version string)
SetLeewayVersion sets the leeway version for telemetry reporting
func Shutdown ¶
func Shutdown(ctx context.Context, tp *sdktrace.TracerProvider) error
Shutdown flushes any pending spans and shuts down the tracer provider. It uses a timeout context to ensure shutdown completes within a reasonable time.
func ValidateTraceParent ¶
ValidateTraceParent validates the format of a traceparent header.
Types ¶
This section is empty.