diff --git a/docs/user-guide/configmap.md b/docs/user-guide/configmap.md index 54a2d11d72..5ce07c26c5 100644 --- a/docs/user-guide/configmap.md +++ b/docs/user-guide/configmap.md @@ -94,6 +94,11 @@ The following table shows a configuration option's name, type, and the default v |[zipkin‑collector‑host](#zipkin-collector-host)|string|""| |[zipkin‑collector‑port](#zipkin-collector-port)|int|9411| |[zipkin‑service‑name](#zipkin-service-name)|string|"nginx"| +|[jaeger‑collector‑host](#jaeger-collector-host)|string|""| +|[jaeger‑collector‑port](#jaeger-collector-port)|int|6831| +|[jaeger‑service‑name](#jaeger-service-name)|string|"nginx"| +|[jaeger‑sampler‑type](#jaeger-sampler-type)|string|"const"| +|[jaeger‑sampler‑param](#jaeger-sampler-param)|string|"1"| |[http‑snippet](#http-snippet)|string|""| |[server‑snippet](#server-snippet)|string|""| |[location‑snippet](#location-snippet)|string|""| @@ -554,6 +559,27 @@ Specifies the port to use when uploading traces. Default: 9411 Specifies the service name to use for any traces created. Default: nginx +## jaeger-collector-host + +Specifies the host to use when uploading traces. It must be a valid URL. + +## jaeger-collector-port + +Specifies the port to use when uploading traces. Default: 6831 + +## jaeger-service-name + +Specifies the service name to use for any traces created. Default: nginx + +## jaeger-sampler-type + +Specifies the sampler to be used when sampling traces. The available samplers are: const, probabilistic, ratelimiting, remote. Default const. + +## jaeger-sampler-param + +Specifies the argument to be passed to the sampler constructor. Must be a number. +For const this should be 0 to never sample and 1 to always sample. Default: 1 + ## http-snippet Adds custom configuration to the http section of the nginx configuration. diff --git a/internal/ingress/controller/config/config.go b/internal/ingress/controller/config/config.go index 05ff73bec0..9116c68966 100644 --- a/internal/ingress/controller/config/config.go +++ b/internal/ingress/controller/config/config.go @@ -423,6 +423,25 @@ type Configuration struct { // Default: nginx ZipkinServiceName string `json:"zipkin-service-name"` + // JaegerCollectorHost specifies the host to use when uploading traces + JaegerCollectorHost string `json:"jaeger-collector-host"` + + // JaegerCollectorPort specifies the port to use when uploading traces + JaegerCollectorPort int `json:"jaeger-collector-port"` + + // JaegerServiceName specifies the service name to use for any traces created + // Default: nginx + JaegerServiceName string `json:"jaeger-service-name"` + + // JaegerSamplerType specifies the sampler to be used when sampling traces. + // The available samplers are: const, probabilistic, ratelimiting, remote + // Default: const + JaegerSamplerType string `json:"jaeger-sampler-type"` + + // JaegerSamplerParam specifies the argument to be passed to the sampler constructor + // Default: 1 + JaegerSamplerParam string `json:"jaeger-sampler-param"` + // HTTPSnippet adds custom configuration to the http section of the nginx configuration HTTPSnippet string `json:"http-snippet"` @@ -524,6 +543,10 @@ func NewDefault() Configuration { BindAddressIpv6: defBindAddress, ZipkinCollectorPort: 9411, ZipkinServiceName: "nginx", + JaegerCollectorPort: 6831, + JaegerServiceName: "nginx", + JaegerSamplerType: "const", + JaegerSamplerParam: "1", } if glog.V(5) { diff --git a/rootfs/etc/nginx/template/nginx.tmpl b/rootfs/etc/nginx/template/nginx.tmpl index e44737bb78..d41caf1b2d 100644 --- a/rootfs/etc/nginx/template/nginx.tmpl +++ b/rootfs/etc/nginx/template/nginx.tmpl @@ -19,6 +19,10 @@ load_module /etc/nginx/modules/ngx_http_opentracing_module.so; load_module /etc/nginx/modules/ngx_http_zipkin_module.so; {{ end }} +{{ if (and $cfg.EnableOpentracing (ne $cfg.JaegerCollectorHost "")) }} +load_module /etc/nginx/modules/ngx_http_jaeger_module.so; +{{ end }} + daemon off; worker_processes {{ $cfg.WorkerProcesses }}; @@ -105,9 +109,14 @@ http { {{ end }} {{ if (and $cfg.EnableOpentracing (ne $cfg.ZipkinCollectorHost "")) }} - zipkin_collector_host {{ $cfg.ZipkinCollectorHost }}; - zipkin_collector_port {{ $cfg.ZipkinCollectorPort }}; - zipkin_service_name {{ $cfg.ZipkinServiceName }}; + zipkin_collector_host {{ $cfg.ZipkinCollectorHost }}; + zipkin_collector_port {{ $cfg.ZipkinCollectorPort }}; + zipkin_service_name {{ $cfg.ZipkinServiceName }}; + {{ else if (and $cfg.EnableOpentracing (ne $cfg.JaegerCollectorHost "")) }} + jaeger_reporter_local_agent_host_port {{ $cfg.JaegerCollectorHost }}:{{ $cfg.JaegerCollectorPort }}; + jaeger_service_name {{ $cfg.JaegerServiceName }}; + jaeger_sampler_type {{ $cfg.JaegerSamplerType }}; + jaeger_sampler_param {{ $cfg.JaegerSamplerParam }}; {{ end }} include /etc/nginx/mime.types;