Add Tracing Header Context Name option for Jaeger

This commit is contained in:
Mohamed Abdelkader Hizaoui 2019-02-05 18:20:03 +01:00 committed by Traefiker Bot
parent f0ee2890b2
commit 156f6b8d3c
17 changed files with 327 additions and 49 deletions

View file

@ -6,6 +6,7 @@ import (
"github.com/containous/traefik/log"
"github.com/opentracing/opentracing-go"
jaeger "github.com/uber/jaeger-client-go"
jaegercfg "github.com/uber/jaeger-client-go/config"
"github.com/uber/jaeger-client-go/zipkin"
jaegermet "github.com/uber/jaeger-lib/metrics"
@ -16,12 +17,13 @@ const Name = "jaeger"
// Config provides configuration settings for a jaeger tracer
type Config struct {
SamplingServerURL string `description:"set the sampling server url." export:"false"`
SamplingType string `description:"set the sampling type." export:"true"`
SamplingParam float64 `description:"set the sampling parameter." export:"true"`
LocalAgentHostPort string `description:"set jaeger-agent's host:port that the reporter will used." export:"false"`
Gen128Bit bool `description:"generate 128 bit span IDs." export:"true"`
Propagation string `description:"which propgation format to use (jaeger/b3)." export:"true"`
SamplingServerURL string `description:"set the sampling server url." export:"false"`
SamplingType string `description:"set the sampling type." export:"true"`
SamplingParam float64 `description:"set the sampling parameter." export:"true"`
LocalAgentHostPort string `description:"set jaeger-agent's host:port that the reporter will used." export:"false"`
Gen128Bit bool `description:"generate 128 bit span IDs." export:"true"`
Propagation string `description:"which propgation format to use (jaeger/b3)." export:"true"`
TraceContextHeaderName string `description:"set the header to use for the trace-id." export:"true"`
}
// Setup sets up the tracer
@ -36,6 +38,9 @@ func (c *Config) Setup(componentName string) (opentracing.Tracer, io.Closer, err
LogSpans: true,
LocalAgentHostPort: c.LocalAgentHostPort,
},
Headers: &jaeger.HeadersConfig{
TraceContextHeaderName: c.TraceContextHeaderName,
},
}
jMetricsFactory := jaegermet.NullFactory