feat: set service name in tracing (#3533)

This commit is contained in:
Livio Amstutz
2022-04-28 17:35:56 +02:00
committed by GitHub
parent 44a2b81bef
commit 2af3e228e4
5 changed files with 28 additions and 21 deletions

View File

@@ -12,13 +12,11 @@ import (
)
type Config struct {
Fraction float64
MetricPrefix string
Fraction float64
}
func NewTracer(rawConfig map[string]interface{}) (err error) {
c := new(Config)
c.MetricPrefix, _ = rawConfig["metricprefix"].(string)
fraction, ok := rawConfig["fraction"].(string)
if ok {
c.Fraction, err = strconv.ParseFloat(fraction, 32)
@@ -41,6 +39,6 @@ func (c *Config) NewTracer() error {
return err
}
tracing.T = &Tracer{Tracer: *(otel.NewTracer(c.MetricPrefix, sampler, exporter))}
return nil
tracing.T, err = otel.NewTracer(sampler, exporter)
return err
}