Exports OTEL initialization function and adds extensive documentation across packages for improved clarity.

This commit is contained in:
2025-08-13 16:01:51 -04:00
parent 31fc6dca16
commit 318115690d
16 changed files with 50 additions and 23 deletions

View File

@@ -1,3 +1,4 @@
// Package otel provides OpenTelemetry initialization and configuration for tracing and metrics.
package otel
import (
@@ -39,6 +40,7 @@ var (
const defMetricInterval = 15 * time.Second
// Init prepares otel, loading a tracer and meter stored in appp context.
// Context must carry config.AppConfig
func Init(ctx context.Context) (context.Context, func(context.Context) error) {
cfg := config.MustFromCtx(ctx)
@@ -232,7 +234,7 @@ func (s *settings) newMeterProvider(ctx context.Context) (*metric.MeterProvider,
return meterProvider, nil
}
// Creates a new tracer from the global opentelemetry provider
// NewTracer creates a new tracer from the global opentelemetry provider
func NewTracer(options ...trace.TracerOption) trace.Tracer {
return opentelemetry.GetTracerProvider().Tracer(
os.Getenv("OTEL_SERVICE_NAME"),