grafana/pkg/plugins/config/tracing.go
Giuseppe Guerra 7b4bcc86f1
Plugins: Pass OTEL sampling config to plugins (#76834)
* Pass OTEL sampling config to plugins

* fix capital letters

* Do not pass sampler env vars if sampling is not configured

* Add tests

* PR review feedback

* Simplify tracing env vars logic

* Update test to reflect pkg/infra/tracing behaviour
2023-11-10 14:56:08 +01:00

22 lines
552 B
Go

package config
type Tracing struct {
OpenTelemetry OpenTelemetryCfg
}
// OpenTelemetryCfg contains the OpenTelemetry address and propagation config values.
// This is used to export the OpenTelemetry (OTLP) config without exposing the whole *setting.Cfg.
type OpenTelemetryCfg struct {
Address string
Propagation string
Sampler string
SamplerParam float64
SamplerRemoteURL string
}
// IsEnabled returns true if OTLP tracing is enabled (address set)
func (t Tracing) IsEnabled() bool {
return t.OpenTelemetry.Address != ""
}