From d5563a7e472f4bf178f933e7c4c7558857e96848 Mon Sep 17 00:00:00 2001 From: Mike Kabischev Date: Tue, 17 Sep 2019 12:35:53 +0300 Subject: [PATCH] allow to configure jaeger header names --- .../nginx-configuration/configmap.md | 20 +++++++++++++++++++ .../third-party-addons/opentracing.md | 12 +++++++++++ internal/ingress/controller/config/config.go | 16 +++++++++++++++ internal/ingress/controller/nginx.go | 8 +++++++- 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/nginx-configuration/configmap.md b/docs/user-guide/nginx-configuration/configmap.md index d2f8b5e81e..41aee95a15 100755 --- a/docs/user-guide/nginx-configuration/configmap.md +++ b/docs/user-guide/nginx-configuration/configmap.md @@ -125,6 +125,10 @@ The following table shows a configuration option's name, type, and the default v |[jaeger-sampler-param](#jaeger-sampler-param)|string|"1"| |[jaeger-sampler-host](#jaeger-sampler-host)|string|"http://127.0.0.1"| |[jaeger-sampler-port](#jaeger-sampler-port)|int|5778| +|[jaeger-trace-context-header-name](#jaeger-trace-context-header-name)|string|uber-trace-id| +|[jaeger-debug-header](#jaeger-debug-header)|string|uber-debug-id| +|[jaeger-baggage-header](#jaeger-baggage-header)|string|jaeger-baggage| +|[jaeger-trace-baggage-header-prefix](#jaeger-trace-baggage-header-prefix)|string|uberctx-| |[main-snippet](#main-snippet)|string|""| |[http-snippet](#http-snippet)|string|""| |[server-snippet](#server-snippet)|string|""| @@ -747,6 +751,22 @@ Leave blank to use default value (localhost). _**default:**_ http://127.0.0.1 Specifies the custom remote sampler port to be passed to the sampler constructor. Must be a number. _**default:**_ 5778 +## jaeger-trace-context-header-name + +Specifies the header name used for passing trace context. _**default:**_ uber-trace-id + +## jaeger-debug-header + +Specifies the header name used for force sampling. _**default:**_ jaeger-debug-id + +## jaeger-baggage-header + +Specifies the header name used to submit baggage if there is no root span. _**default:**_ jaeger-baggage + +## jaeger-tracer-baggage-header-prefix + +Specifies the header prefix used to propagate baggage. _**default:**_ uberctx- + ## main-snippet Adds custom configuration to the main section of the nginx configuration. diff --git a/docs/user-guide/third-party-addons/opentracing.md b/docs/user-guide/third-party-addons/opentracing.md index 18b41b00c1..a5bbd49ea6 100644 --- a/docs/user-guide/third-party-addons/opentracing.md +++ b/docs/user-guide/third-party-addons/opentracing.md @@ -59,6 +59,18 @@ jaeger-sampler-host # Specifies the custom remote sampler port to be passed to the sampler constructor. Must be a number. Default: 5778 jaeger-sampler-port +# Specifies the header name used for passing trace context. Must be a string. Default: uber-trace-id +jaeger-trace-context-header-name + +# Specifies the header name used for force sampling. Must be a string. Default: jaeger-debug-id +jaeger-debug-header + +# Specifies the header name used to submit baggage if there is no root span. Must be a string. Default: jaeger-baggage +jaeger-baggage-header + +# Specifies the header prefix used to propagate baggage. Must be a string. Default: uberctx- +jaeger-tracer-baggage-header-prefix + # specifies the port to use when uploading traces, Default 8126 datadog-collector-port diff --git a/internal/ingress/controller/config/config.go b/internal/ingress/controller/config/config.go index bb95e21537..6950bab9c9 100644 --- a/internal/ingress/controller/config/config.go +++ b/internal/ingress/controller/config/config.go @@ -515,6 +515,22 @@ type Configuration struct { // Default: 5778 JaegerSamplerPort int `json:"jaeger-sampler-port"` + // JaegerTraceContextHeaderName specifies the header name used for passing trace context + // Default: uber-trace-id + JaegerTraceContextHeaderName string `json:"jaeger-trace-context-header-name"` + + // JaegerDebugHeader specifies the header name used for force sampling + // Default: jaeger-debug-id + JaegerDebugHeader string `json:"jaeger-debug-header"` + + // JaegerBaggageHeader specifies the header name used to submit baggage if there is no root span + // Default: jaeger-baggage + JaegerBaggageHeader string `json:"jaeger-baggage-header"` + + // TraceBaggageHeaderPrefix specifies the header prefix used to propagate baggage + // Default: uberctx- + JaegerTraceBaggageHeaderPrefix string `json:"jaeger-tracer-baggage-header-prefix"` + // DatadogCollectorHost specifies the datadog agent host to use when uploading traces DatadogCollectorHost string `json:"datadog-collector-host"` diff --git a/internal/ingress/controller/nginx.go b/internal/ingress/controller/nginx.go index 5a1317535f..fd4bc78a82 100644 --- a/internal/ingress/controller/nginx.go +++ b/internal/ingress/controller/nginx.go @@ -1067,7 +1067,13 @@ const jaegerTmpl = `{ }, "reporter": { "localAgentHostPort": "{{ .JaegerCollectorHost }}:{{ .JaegerCollectorPort }}" - } + }, + "headers": { + "TraceContextHeaderName": "{{ .JaegerTraceContextHeaderName }}", + "jaegerDebugHeader": "{{ .JaegerDebugHeader }}", + "jaegerBaggageHeader": "{{ .JaegerBaggageHeader }}", + "traceBaggageHeaderPrefix": "{{ .JaegerTraceBaggageHeaderPrefix }}" + }, }` const datadogTmpl = `{