Override jaeger configuration with env variables

This commit is contained in:
Michael 2021-06-18 18:10:05 +02:00 committed by GitHub
parent 9af0e705a5
commit 2ccdc419d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 5 deletions

View file

@ -68,7 +68,7 @@ func (c *Config) Setup(componentName string) (opentracing.Tracer, io.Closer, err
reporter.Password = c.Collector.Password
}
jcfg := jaegercfg.Configuration{
jcfg := &jaegercfg.Configuration{
Sampler: &jaegercfg.SamplerConfig{
SamplingServerURL: c.SamplingServerURL,
Type: c.SamplingType,
@ -80,6 +80,12 @@ func (c *Config) Setup(componentName string) (opentracing.Tracer, io.Closer, err
},
}
// Overrides existing tracer's Configuration with environment variables.
_, err := jcfg.FromEnv()
if err != nil {
return nil, nil, err
}
jMetricsFactory := jaegermet.NullFactory
opts := []jaegercfg.Option{
@ -106,7 +112,7 @@ func (c *Config) Setup(componentName string) (opentracing.Tracer, io.Closer, err
opts...,
)
if err != nil {
log.WithoutContext().Warnf("Could not initialize jaeger tracer: %s", err.Error())
log.WithoutContext().Warnf("Could not initialize jaeger tracer: %v", err)
return nil, nil, err
}
log.WithoutContext().Debug("Jaeger tracer configured")