Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitTracer ¶ added in v1.0.0
func InitTracer(log logrus.FieldLogger, cfg *config.Config, serviceName string) func(context.Context) error
InitTracer initializes OpenTelemetry tracing using the provided config. It sets the global TracerProvider, which will be used for all span creation throughout the application. If tracing is disabled or misconfigured, a no-op tracer provider is used instead.
The returned shutdown function should be called on application exit to ensure all spans are flushed.
func RunMetricsServer ¶ added in v1.0.0
func RunMetricsServer( ctx context.Context, log logrus.FieldLogger, addr string, collectors ...prometheus.Collector, ) error
RunMetricsServer starts the metrics server and wraps /metrics with OTEL HTTP middleware so every scrape produces a server span named "metrics-http-server".
func StartSpan ¶
func StartSpan(ctx context.Context, tracerName, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
StartSpan creates a new span using the global tracer provider. It uses the provided context to determine the parent span (if any), and returns a new context and the started span. The span name is normalized to kebab-case.
Types ¶
This section is empty.