API Server: Standalone observability (#84789)

Adds support for logs (specify level), metrics (enable metrics and Prometheus /metrics endpoint 
and traces (jaeger or otlp) for standalone API server. This will allow any grafana core service 
part of standalone apiserver to use logging, metrics and traces as normal.
This commit is contained in:
Marcus Efraimsson authored and GitHub committed 2024-03-21 17:06:32 +01:00
1 parent 856ed64aac
commit 6c1de260a2
22 files changed
+860 -445

No files matched your search

@@ -11,20 +11,20 @@ import (
// newTracingCfg creates a plugins tracing configuration based on the provided Grafana tracing config.
// If OpenTelemetry (OTLP) is disabled, a zero-value OpenTelemetryCfg is returned.
func newTracingCfg(grafanaCfg *setting.Cfg) (pCfg.Tracing, error) {
ots, err := tracing.ParseSettings(grafanaCfg)
tracingCfg, err := tracing.ParseTracingConfig(grafanaCfg)
if err != nil {
return pCfg.Tracing{}, fmt.Errorf("parse settings: %w", err)
}
if !ots.OTelExporterEnabled() {
if !tracingCfg.OTelExporterEnabled() {
return pCfg.Tracing{}, nil
}
return pCfg.Tracing{
OpenTelemetry: pCfg.OpenTelemetryCfg{
Address: ots.Address,
Propagation: ots.Propagation,
Sampler: ots.Sampler,
SamplerParam: ots.SamplerParam,
SamplerRemoteURL: ots.SamplerRemoteURL,
Address: tracingCfg.Address,
Propagation: tracingCfg.Propagation,
Sampler: tracingCfg.Sampler,
SamplerParam: tracingCfg.SamplerParam,
SamplerRemoteURL: tracingCfg.SamplerRemoteURL,
},
}, nil
}