Add support for jaeger backend (#1916)
This commit is contained in:
parent
07c2bb8dde
commit
43528407ed
3 changed files with 71 additions and 13 deletions
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
@ -428,8 +437,8 @@ http {
|
|||
# Use the port {{ $all.ListenPorts.Status }} (random value just to avoid known ports) as default port for nginx.
|
||||
# Changing this value requires a change in:
|
||||
# https://github.com/kubernetes/ingress-nginx/blob/master/controllers/nginx/pkg/cmd/controller/nginx.go
|
||||
listen {{ $all.ListenPorts.Status }} default_server reuseport backlog={{ $all.BacklogSize }};
|
||||
{{ if $IsIPV6Enabled }}listen [::]:{{ $all.ListenPorts.Status }} default_server reuseport backlog={{ $all.BacklogSize }};{{ end }}
|
||||
listen {{ $all.ListenPorts.Status }} default_server reuseport backlog={{ $all.Cfg.BacklogSize }};
|
||||
{{ if $IsIPV6Enabled }}listen [::]:{{ $all.ListenPorts.Status }} default_server reuseport backlog={{ $all.Cfg.BacklogSize }};{{ end }}
|
||||
set $proxy_upstream_name "-";
|
||||
|
||||
location {{ $healthzURI }} {
|
||||
|
@ -579,15 +588,15 @@ stream {
|
|||
{{ $all := .First }}
|
||||
{{ $server := .Second }}
|
||||
{{ range $address := $all.Cfg.BindAddressIpv4 }}
|
||||
listen {{ $address }}:{{ $all.ListenPorts.HTTP }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.BacklogSize }}{{end}};
|
||||
listen {{ $address }}:{{ $all.ListenPorts.HTTP }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.Cfg.BacklogSize }}{{end}};
|
||||
{{ else }}
|
||||
listen {{ $all.ListenPorts.HTTP }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.BacklogSize }}{{end}};
|
||||
listen {{ $all.ListenPorts.HTTP }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.Cfg.BacklogSize }}{{end}};
|
||||
{{ end }}
|
||||
{{ if $all.IsIPV6Enabled }}
|
||||
{{ range $address := $all.Cfg.BindAddressIpv6 }}
|
||||
listen {{ $address }}:{{ $all.ListenPorts.HTTP }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.BacklogSize }}{{ end }};
|
||||
listen {{ $address }}:{{ $all.ListenPorts.HTTP }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.Cfg.BacklogSize }}{{ end }};
|
||||
{{ else }}
|
||||
listen [::]:{{ $all.ListenPorts.HTTP }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.BacklogSize }}{{ end }};
|
||||
listen [::]:{{ $all.ListenPorts.HTTP }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.Cfg.BacklogSize }}{{ end }};
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
set $proxy_upstream_name "-";
|
||||
|
@ -596,15 +605,15 @@ stream {
|
|||
{{/* This listener must always have proxy_protocol enabled, because the SNI listener forwards on source IP info in it. */}}
|
||||
{{ if not (empty $server.SSLCertificate) }}
|
||||
{{ range $address := $all.Cfg.BindAddressIpv4 }}
|
||||
listen {{ $address }}:{{ if $all.IsSSLPassthroughEnabled }}{{ $all.ListenPorts.SSLProxy }} proxy_protocol {{ else }}{{ $all.ListenPorts.HTTPS }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ end }} {{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.BacklogSize }}{{end}} ssl {{ if $all.Cfg.UseHTTP2 }}http2{{ end }};
|
||||
listen {{ $address }}:{{ if $all.IsSSLPassthroughEnabled }}{{ $all.ListenPorts.SSLProxy }} proxy_protocol {{ else }}{{ $all.ListenPorts.HTTPS }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ end }} {{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.Cfg.BacklogSize }}{{end}} ssl {{ if $all.Cfg.UseHTTP2 }}http2{{ end }};
|
||||
{{ else }}
|
||||
listen {{ if $all.IsSSLPassthroughEnabled }}{{ $all.ListenPorts.SSLProxy }} proxy_protocol {{ else }}{{ $all.ListenPorts.HTTPS }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ end }} {{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.BacklogSize }}{{end}} ssl {{ if $all.Cfg.UseHTTP2 }}http2{{ end }};
|
||||
listen {{ if $all.IsSSLPassthroughEnabled }}{{ $all.ListenPorts.SSLProxy }} proxy_protocol {{ else }}{{ $all.ListenPorts.HTTPS }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ end }} {{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.Cfg.BacklogSize }}{{end}} ssl {{ if $all.Cfg.UseHTTP2 }}http2{{ end }};
|
||||
{{ end }}
|
||||
{{ if $all.IsIPV6Enabled }}
|
||||
{{ range $address := $all.Cfg.BindAddressIpv6 }}
|
||||
{{ if not (empty $server.SSLCertificate) }}listen {{ $address }}:{{ if $all.IsSSLPassthroughEnabled }}{{ $all.ListenPorts.SSLProxy }} proxy_protocol{{ else }}{{ $all.ListenPorts.HTTPS }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ end }}{{ end }} {{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.BacklogSize }}{{end}} ssl {{ if $all.Cfg.UseHTTP2 }}http2{{ end }};
|
||||
{{ if not (empty $server.SSLCertificate) }}listen {{ $address }}:{{ if $all.IsSSLPassthroughEnabled }}{{ $all.ListenPorts.SSLProxy }} proxy_protocol{{ else }}{{ $all.ListenPorts.HTTPS }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ end }}{{ end }} {{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.Cfg.BacklogSize }}{{end}} ssl {{ if $all.Cfg.UseHTTP2 }}http2{{ end }};
|
||||
{{ else }}
|
||||
{{ if not (empty $server.SSLCertificate) }}listen [::]:{{ if $all.IsSSLPassthroughEnabled }}{{ $all.ListenPorts.SSLProxy }} proxy_protocol{{ else }}{{ $all.ListenPorts.HTTPS }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ end }}{{ end }} {{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.BacklogSize }}{{end}} ssl {{ if $all.Cfg.UseHTTP2 }}http2{{ end }};
|
||||
{{ if not (empty $server.SSLCertificate) }}listen [::]:{{ if $all.IsSSLPassthroughEnabled }}{{ $all.ListenPorts.SSLProxy }} proxy_protocol{{ else }}{{ $all.ListenPorts.HTTPS }}{{ if $all.Cfg.UseProxyProtocol }} proxy_protocol{{ end }}{{ end }}{{ end }} {{ if eq $server.Hostname "_"}} default_server reuseport backlog={{ $all.Cfg.BacklogSize }}{{end}} ssl {{ if $all.Cfg.UseHTTP2 }}http2{{ end }};
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{/* comment PEM sha is required to detect changes in the generated configuration and force a reload */}}
|
||||
|
|
Loading…
Reference in a new issue