20 lines
687 B
Go
20 lines
687 B
Go
|
|
// Package telemetry bootstraps the OpenTelemetry SDK with OTLP gRPC exporters.
|
||
|
|
//
|
||
|
|
// It is a Tier-5 module — imported only by application main packages, never by
|
||
|
|
// framework libraries. Micro-libs use only the OTel API (zero-overhead no-op
|
||
|
|
// default). This module activates the real SDK with OTLP exporters so all
|
||
|
|
// micro-libs using the OTel global API auto-instrument without importing telemetry.
|
||
|
|
//
|
||
|
|
// Usage:
|
||
|
|
//
|
||
|
|
// shutdown, err := telemetry.New(ctx, telemetry.Config{
|
||
|
|
// ServiceName: "order-service",
|
||
|
|
// OTLPEndpoint: "alloy:4317",
|
||
|
|
// OTLPInsecure: true,
|
||
|
|
// })
|
||
|
|
// if err != nil {
|
||
|
|
// log.Fatalf("telemetry: %v", err)
|
||
|
|
// }
|
||
|
|
// defer shutdown(ctx)
|
||
|
|
package telemetry
|