Documentation
¶
Overview ¶
Package telemetry wires OpenTelemetry: traces and metrics exported over OTLP.
One SDK covers both signals and stays vendor-neutral — the collector decides where data actually goes, so switching backends is a collector config change rather than a code change.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Enabled turns exporting on. When false the service still runs and the
// OTel API still works — it just resolves to no-ops, so local development
// never requires a collector.
Enabled bool `yaml:"Enabled"`
ServiceName string `yaml:"ServiceName"`
ServiceVersion string `yaml:"ServiceVersion"`
Environment string `yaml:"Environment"`
// Endpoint is the OTLP/gRPC collector address, e.g. localhost:4317.
Endpoint string `yaml:"Endpoint"`
// Insecure disables TLS to the collector. True for a local collector,
// false anywhere the data crosses a network worth protecting.
Insecure bool `yaml:"Insecure"`
// SampleRatio is the fraction of traces recorded, 0..1. Payments volume is
// low (plan.md Q6), so sampling everything is affordable and much more
// useful when investigating a single customer's failed payment.
SampleRatio float64 `yaml:"SampleRatio"`
// MetricInterval is how often metrics are pushed to the collector.
MetricInterval time.Duration `yaml:"MetricInterval"`
}
type Shutdown ¶
Shutdown flushes pending telemetry. Call it on the way out, or the last spans before a crash — the interesting ones — are lost.