Improve tracing
This commit is contained in:
parent
4245096be4
commit
84d7c65039
23 changed files with 924 additions and 411 deletions
|
@ -292,7 +292,6 @@ func Test_decodeFileToNode_Toml(t *testing.T) {
|
|||
{Name: "MaxIdleConnsPerHost", Value: "42"},
|
||||
{Name: "RootCAs", Value: "foobar,foobar"}}},
|
||||
{Name: "Tracing", Children: []*parser.Node{
|
||||
{Name: "Backend", Value: "foobar"},
|
||||
{Name: "DataDog", Children: []*parser.Node{
|
||||
{Name: "BagagePrefixHeaderName", Value: "foobar"},
|
||||
{Name: "Debug", Value: "true"},
|
||||
|
@ -302,6 +301,13 @@ func Test_decodeFileToNode_Toml(t *testing.T) {
|
|||
{Name: "PrioritySampling", Value: "true"},
|
||||
{Name: "SamplingPriorityHeaderName", Value: "foobar"},
|
||||
{Name: "TraceIDHeaderName", Value: "foobar"}}},
|
||||
{Name: "Haystack", Children: []*parser.Node{
|
||||
{Name: "GlobalTag", Value: "foobar"},
|
||||
{Name: "LocalAgentHost", Value: "foobar"},
|
||||
{Name: "LocalAgentPort", Value: "42"},
|
||||
{Name: "ParentIDHeaderName", Value: "foobar"},
|
||||
{Name: "SpanIDHeaderName", Value: "foobar"},
|
||||
{Name: "TraceIDHeaderName", Value: "foobar"}}},
|
||||
{Name: "Instana", Children: []*parser.Node{
|
||||
{Name: "LocalAgentHost", Value: "foobar"},
|
||||
{Name: "LocalAgentPort", Value: "42"},
|
||||
|
@ -561,7 +567,6 @@ func Test_decodeFileToNode_Yaml(t *testing.T) {
|
|||
{Name: "MaxIdleConnsPerHost", Value: "42"},
|
||||
{Name: "RootCAs", Value: "foobar,foobar"}}},
|
||||
{Name: "Tracing", Children: []*parser.Node{
|
||||
{Name: "Backend", Value: "foobar"},
|
||||
{Name: "DataDog", Children: []*parser.Node{
|
||||
{Name: "BagagePrefixHeaderName", Value: "foobar"},
|
||||
{Name: "Debug", Value: "true"},
|
||||
|
@ -571,6 +576,13 @@ func Test_decodeFileToNode_Yaml(t *testing.T) {
|
|||
{Name: "PrioritySampling", Value: "true"},
|
||||
{Name: "SamplingPriorityHeaderName", Value: "foobar"},
|
||||
{Name: "TraceIDHeaderName", Value: "foobar"}}},
|
||||
{Name: "Haystack", Children: []*parser.Node{
|
||||
{Name: "GlobalTag", Value: "foobar"},
|
||||
{Name: "LocalAgentHost", Value: "foobar"},
|
||||
{Name: "LocalAgentPort", Value: "42"},
|
||||
{Name: "ParentIDHeaderName", Value: "foobar"},
|
||||
{Name: "SpanIDHeaderName", Value: "foobar"},
|
||||
{Name: "TraceIDHeaderName", Value: "foobar"}}},
|
||||
{Name: "Instana", Children: []*parser.Node{
|
||||
{Name: "LocalAgentHost", Value: "foobar"},
|
||||
{Name: "LocalAgentPort", Value: "42"},
|
||||
|
|
|
@ -205,7 +205,6 @@
|
|||
name1 = "foobar"
|
||||
|
||||
[Tracing]
|
||||
Backend = "foobar"
|
||||
ServiceName = "foobar"
|
||||
SpanNameLimit = 42
|
||||
|
||||
|
@ -240,6 +239,14 @@
|
|||
LocalAgentPort = 42
|
||||
LogLevel = "foobar"
|
||||
|
||||
[Tracing.Haystack]
|
||||
GlobalTag = "foobar"
|
||||
LocalAgentHost = "foobar"
|
||||
LocalAgentPort = 42
|
||||
ParentIDHeaderName = "foobar"
|
||||
SpanIDHeaderName = "foobar"
|
||||
TraceIDHeaderName = "foobar"
|
||||
|
||||
[HostResolver]
|
||||
CnameFlattening = true
|
||||
ResolvConfig = "foobar"
|
||||
|
|
|
@ -193,7 +193,6 @@ AccessLog:
|
|||
name0: foobar
|
||||
name1: foobar
|
||||
Tracing:
|
||||
Backend: foobar
|
||||
ServiceName: foobar
|
||||
SpanNameLimit: 42
|
||||
Jaeger:
|
||||
|
@ -223,6 +222,13 @@ Tracing:
|
|||
LocalAgentHost: foobar
|
||||
LocalAgentPort: 42
|
||||
LogLevel: foobar
|
||||
Haystack:
|
||||
GlobalTag: foobar
|
||||
LocalAgentHost: foobar
|
||||
LocalAgentPort: 42
|
||||
ParentIDHeaderName: foobar
|
||||
TraceIDHeaderName: foobar
|
||||
SpanIDHeaderName: foobar
|
||||
HostResolver:
|
||||
CnameFlattening: true
|
||||
ResolvConfig: foobar
|
||||
|
|
|
@ -24,7 +24,6 @@ import (
|
|||
"github.com/containous/traefik/pkg/types"
|
||||
assetfs "github.com/elazarl/go-bindata-assetfs"
|
||||
"github.com/go-acme/lego/challenge/dns01"
|
||||
jaegercli "github.com/uber/jaeger-client-go"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -130,7 +129,6 @@ func (a *LifeCycle) SetDefaults() {
|
|||
|
||||
// Tracing holds the tracing configuration.
|
||||
type Tracing struct {
|
||||
Backend string `description:"Selects the tracking backend ('jaeger','zipkin','datadog','instana')." export:"true"`
|
||||
ServiceName string `description:"Set the name for this service." export:"true"`
|
||||
SpanNameLimit int `description:"Set the maximum character limit for Span names (default 0 = no limit)." export:"true"`
|
||||
Jaeger *jaeger.Config `description:"Settings for jaeger." label:"allowEmpty"`
|
||||
|
@ -142,7 +140,6 @@ type Tracing struct {
|
|||
|
||||
// SetDefaults sets the default values.
|
||||
func (t *Tracing) SetDefaults() {
|
||||
t.Backend = "jaeger"
|
||||
t.ServiceName = "traefik"
|
||||
t.SpanNameLimit = 0
|
||||
}
|
||||
|
@ -198,103 +195,6 @@ func (c *Configuration) SetEffectiveConfiguration(configFile string) {
|
|||
}
|
||||
|
||||
c.initACMEProvider()
|
||||
c.initTracing()
|
||||
}
|
||||
|
||||
func (c *Configuration) initTracing() {
|
||||
if c.Tracing != nil {
|
||||
switch c.Tracing.Backend {
|
||||
case jaeger.Name:
|
||||
if c.Tracing.Jaeger == nil {
|
||||
c.Tracing.Jaeger = &jaeger.Config{
|
||||
SamplingServerURL: "http://localhost:5778/sampling",
|
||||
SamplingType: "const",
|
||||
SamplingParam: 1.0,
|
||||
LocalAgentHostPort: "127.0.0.1:6831",
|
||||
Propagation: "jaeger",
|
||||
Gen128Bit: false,
|
||||
TraceContextHeaderName: jaegercli.TraceContextHeaderName,
|
||||
}
|
||||
}
|
||||
if c.Tracing.Zipkin != nil {
|
||||
log.Warn("Zipkin configuration will be ignored")
|
||||
c.Tracing.Zipkin = nil
|
||||
}
|
||||
if c.Tracing.DataDog != nil {
|
||||
log.Warn("DataDog configuration will be ignored")
|
||||
c.Tracing.DataDog = nil
|
||||
}
|
||||
if c.Tracing.Instana != nil {
|
||||
log.Warn("Instana configuration will be ignored")
|
||||
c.Tracing.Instana = nil
|
||||
}
|
||||
case zipkin.Name:
|
||||
if c.Tracing.Zipkin == nil {
|
||||
c.Tracing.Zipkin = &zipkin.Config{
|
||||
HTTPEndpoint: "http://localhost:9411/api/v1/spans",
|
||||
SameSpan: false,
|
||||
ID128Bit: true,
|
||||
Debug: false,
|
||||
SampleRate: 1.0,
|
||||
}
|
||||
}
|
||||
if c.Tracing.Jaeger != nil {
|
||||
log.Warn("Jaeger configuration will be ignored")
|
||||
c.Tracing.Jaeger = nil
|
||||
}
|
||||
if c.Tracing.DataDog != nil {
|
||||
log.Warn("DataDog configuration will be ignored")
|
||||
c.Tracing.DataDog = nil
|
||||
}
|
||||
if c.Tracing.Instana != nil {
|
||||
log.Warn("Instana configuration will be ignored")
|
||||
c.Tracing.Instana = nil
|
||||
}
|
||||
case datadog.Name:
|
||||
if c.Tracing.DataDog == nil {
|
||||
c.Tracing.DataDog = &datadog.Config{
|
||||
LocalAgentHostPort: "localhost:8126",
|
||||
GlobalTag: "",
|
||||
Debug: false,
|
||||
}
|
||||
}
|
||||
if c.Tracing.Zipkin != nil {
|
||||
log.Warn("Zipkin configuration will be ignored")
|
||||
c.Tracing.Zipkin = nil
|
||||
}
|
||||
if c.Tracing.Jaeger != nil {
|
||||
log.Warn("Jaeger configuration will be ignored")
|
||||
c.Tracing.Jaeger = nil
|
||||
}
|
||||
if c.Tracing.Instana != nil {
|
||||
log.Warn("Instana configuration will be ignored")
|
||||
c.Tracing.Instana = nil
|
||||
}
|
||||
case instana.Name:
|
||||
if c.Tracing.Instana == nil {
|
||||
c.Tracing.Instana = &instana.Config{
|
||||
LocalAgentHost: "localhost",
|
||||
LocalAgentPort: 42699,
|
||||
LogLevel: "info",
|
||||
}
|
||||
}
|
||||
if c.Tracing.Zipkin != nil {
|
||||
log.Warn("Zipkin configuration will be ignored")
|
||||
c.Tracing.Zipkin = nil
|
||||
}
|
||||
if c.Tracing.Jaeger != nil {
|
||||
log.Warn("Jaeger configuration will be ignored")
|
||||
c.Tracing.Jaeger = nil
|
||||
}
|
||||
if c.Tracing.DataDog != nil {
|
||||
log.Warn("DataDog configuration will be ignored")
|
||||
c.Tracing.DataDog = nil
|
||||
}
|
||||
default:
|
||||
log.Warnf("Unknown tracer %q", c.Tracing.Backend)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME handle on new configuration ACME struct
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue