Add support for jaeger backend (#1916)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2018-01-17 19:28:59 -02:00 committed by GitHub
parent 07c2bb8dde
commit 28058f0edc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 3 deletions

View file

@ -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.

View file

@ -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) {

View file

@ -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;