mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
* move config to pluginsintegration package * change to all plugin toggle * fixes * fixes * fix lerna * fix test
28 lines
781 B
Go
28 lines
781 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/grafana/grafana/pkg/infra/tracing"
|
|
pCfg "github.com/grafana/grafana/pkg/plugins/config"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
)
|
|
|
|
// 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.ParseSettingsOpentelemetry(grafanaCfg)
|
|
if err != nil {
|
|
return pCfg.Tracing{}, fmt.Errorf("parse settings: %w", err)
|
|
}
|
|
if !ots.OTelExporterEnabled() {
|
|
return pCfg.Tracing{}, nil
|
|
}
|
|
return pCfg.Tracing{
|
|
OpenTelemetry: pCfg.OpenTelemetryCfg{
|
|
Address: ots.Address,
|
|
Propagation: ots.Propagation,
|
|
},
|
|
}, nil
|
|
}
|