Documentation
¶
Overview ¶
Package telemetry builds OpenTelemetry providers that export over OTLP. It knows nothing of AppTown: a caller names an endpoint and a resource and gets a tracer, a meter and a logger provider, plus one bounded Close.
Index ¶
Constants ¶
const ( DefaultMetricInterval = 15 * time.Second DefaultCloseTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Endpoint string // host:port of the OTLP receiver
Protocol string // "http" (default) or "grpc"; all three signals follow it
Insecure bool // plain TCP; the LAN case
Headers map[string]string // sent with every export, for receivers that want one
// The resource every signal carries.
ServiceName string
ServiceNamespace string
Attributes map[string]string
// Bounds. Zero means the defaults below.
MetricInterval time.Duration // how often the meter pushes
CloseTimeout time.Duration // the most Close waits for a final flush
}
Config names where to export and what the exporting process is.
type Providers ¶
type Providers struct {
Tracer trace.TracerProvider
Meter metric.MeterProvider
Logger *sdklog.LoggerProvider
// contains filtered or unexported fields
}
Providers is what Start hands back. The three providers are what a program instruments with; Close flushes and stops them within the configured bound.
func Start ¶
Start builds exporters and providers for cfg. It opens no connection eagerly for HTTP; a bad endpoint surfaces on the first export, which the SDKs report through their error handler rather than by failing the program.