Skip to content

Commit

Permalink
Add support for jaeger backend (#1916)
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf authored Jan 17, 2018
1 parent 07c2bb8 commit 28058f0
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
26 changes: 26 additions & 0 deletions docs/user-guide/configmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|""|
Expand Down Expand Up @@ -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.
Expand Down
23 changes: 23 additions & 0 deletions internal/ingress/controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down Expand Up @@ -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) {
Expand Down
15 changes: 12 additions & 3 deletions rootfs/etc/nginx/template/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 28058f0

Please sign in to comment.