From bc53d1eb743f96c0ebf9193965d46e062b304202 Mon Sep 17 00:00:00 2001 From: Andrii Kostenko Date: Thu, 28 Jun 2018 17:42:32 +0300 Subject: [PATCH] Sample rate configmap option for zipkin in nginx-opentracing --- docs/user-guide/nginx-configuration/configmap.md | 5 +++++ docs/user-guide/third-party-addons/opentracing.md | 3 +++ internal/ingress/controller/config/config.go | 5 +++++ internal/ingress/controller/nginx.go | 3 ++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/nginx-configuration/configmap.md b/docs/user-guide/nginx-configuration/configmap.md index 77539ed8cf..7233d5e09c 100644 --- a/docs/user-guide/nginx-configuration/configmap.md +++ b/docs/user-guide/nginx-configuration/configmap.md @@ -107,6 +107,7 @@ 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"| +|[zipkin-sample-rate](#zipkin-sample-rate)|float|1.0| |[jaeger-collector-host](#jaeger-collector-host)|string|""| |[jaeger-collector-port](#jaeger-collector-port)|int|6831| |[jaeger-service-name](#jaeger-service-name)|string|"nginx"| @@ -601,6 +602,10 @@ Specifies the port to use when uploading traces. _**default:**_ 9411 Specifies the service name to use for any traces created. _**default:**_ nginx +## zipkin-sample-rate + +Specifies sample rate for any traces created. _**default:**_ 1.0 + ## jaeger-collector-host Specifies the host to use when uploading traces. It must be a valid URL. diff --git a/docs/user-guide/third-party-addons/opentracing.md b/docs/user-guide/third-party-addons/opentracing.md index 74a3718529..559decb36a 100644 --- a/docs/user-guide/third-party-addons/opentracing.md +++ b/docs/user-guide/third-party-addons/opentracing.md @@ -31,6 +31,9 @@ zipkin-collector-port # specifies the service name to use for any traces created, Default: nginx zipkin-service-name +# specifies sample rate for any traces created. Default: 1.0 +zipkin-sample-rate + # specifies the port to use when uploading traces jaeger-collector-port diff --git a/internal/ingress/controller/config/config.go b/internal/ingress/controller/config/config.go index a5f3930732..05bc69a679 100644 --- a/internal/ingress/controller/config/config.go +++ b/internal/ingress/controller/config/config.go @@ -433,6 +433,10 @@ type Configuration struct { // Default: nginx ZipkinServiceName string `json:"zipkin-service-name"` + // ZipkinSampleRate specifies sampling rate for traces + // Default: 1.0 + ZipkinSampleRate float32 `json:"zipkin-sample-rate"` + // JaegerCollectorHost specifies the host to use when uploading traces JaegerCollectorHost string `json:"jaeger-collector-host"` @@ -612,6 +616,7 @@ func NewDefault() Configuration { BindAddressIpv6: defBindAddress, ZipkinCollectorPort: 9411, ZipkinServiceName: "nginx", + ZipkinSampleRate: 1.0, JaegerCollectorPort: 6831, JaegerServiceName: "nginx", JaegerSamplerType: "const", diff --git a/internal/ingress/controller/nginx.go b/internal/ingress/controller/nginx.go index 10d6454367..3764cec241 100644 --- a/internal/ingress/controller/nginx.go +++ b/internal/ingress/controller/nginx.go @@ -787,7 +787,8 @@ func configureDynamically(pcfg *ingress.Configuration, port int) error { const zipkinTmpl = `{ "service_name": "{{ .ZipkinServiceName }}", "collector_host": "{{ .ZipkinCollectorHost }}", - "collector_port": {{ .ZipkinCollectorPort }} + "collector_port": {{ .ZipkinCollectorPort }}, + "sample_rate": {{ .ZipkinSampleRate }} }` const jaegerTmpl = `{