mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* remove opentracing and use otel instead * add various samplers for jaeger * remove useless test that is covered in otel now * we do not need a struct there * remove old tests * restore tests that parse various configurations * check errors in tests * Update pkg/infra/tracing/tracing_test.go fix typo Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com> * add test for both legacy and new config formats * use named constants --------- Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
28 lines
768 B
Go
28 lines
768 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.ParseSettings(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
|
|
}
|