mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 07:42:45 +08:00
Plugins: Refactor plugin config into separate env var and request scoped services (#83261)
* seperate services for env + req * merge with main * fix tests * undo changes to golden file * fix linter * remove unused fields * split out new config struct * provide config * undo go mod changes * more renaming * fix tests * undo bra.toml changes * update go.work.sum * undo changes * trigger * apply PR feedback
This commit is contained in:
30
pkg/services/pluginsintegration/pluginconfig/tracing.go
Normal file
30
pkg/services/pluginsintegration/pluginconfig/tracing.go
Normal file
@ -0,0 +1,30 @@
|
||||
package pluginconfig
|
||||
|
||||
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,
|
||||
Sampler: ots.Sampler,
|
||||
SamplerParam: ots.SamplerParam,
|
||||
SamplerRemoteURL: ots.SamplerRemoteURL,
|
||||
},
|
||||
}, nil
|
||||
}
|
Reference in New Issue
Block a user