add support for the jaeger propagation format
adding default, testing w3c traceparent is propagated
This commit is contained in:
parent
03cf9cf59d
commit
71c8ef119d
5 changed files with 47 additions and 2 deletions
|
@ -854,6 +854,10 @@ Specifies the endpoint to use when uploading traces to a collector. This takes p
|
||||||
|
|
||||||
Specifies the service name to use for any traces created. _**default:**_ nginx
|
Specifies the service name to use for any traces created. _**default:**_ nginx
|
||||||
|
|
||||||
|
## jaeger-propagation-format
|
||||||
|
|
||||||
|
Specifies the traceparent/tracestate propagation format. _**default:**_ jaeger
|
||||||
|
|
||||||
## jaeger-sampler-type
|
## jaeger-sampler-type
|
||||||
|
|
||||||
Specifies the sampler to be used when sampling traces. The available samplers are: const, probabilistic, ratelimiting, remote. _**default:**_ const
|
Specifies the sampler to be used when sampling traces. The available samplers are: const, probabilistic, ratelimiting, remote. _**default:**_ const
|
||||||
|
|
|
@ -64,6 +64,9 @@ jaeger-endpoint
|
||||||
# specifies the service name to use for any traces created, Default: nginx
|
# specifies the service name to use for any traces created, Default: nginx
|
||||||
jaeger-service-name
|
jaeger-service-name
|
||||||
|
|
||||||
|
# specifies the traceparent/tracestate propagation format
|
||||||
|
jaeger-propagation-format
|
||||||
|
|
||||||
# specifies the sampler to be used when sampling traces.
|
# specifies the sampler to be used when sampling traces.
|
||||||
# The available samplers are: const, probabilistic, ratelimiting, remote, Default: const
|
# The available samplers are: const, probabilistic, ratelimiting, remote, Default: const
|
||||||
jaeger-sampler-type
|
jaeger-sampler-type
|
||||||
|
|
|
@ -562,6 +562,9 @@ type Configuration struct {
|
||||||
// Default: nginx
|
// Default: nginx
|
||||||
JaegerServiceName string `json:"jaeger-service-name"`
|
JaegerServiceName string `json:"jaeger-service-name"`
|
||||||
|
|
||||||
|
// JaegerPropagationFormat specifies the traceparent/tracestate propagation format
|
||||||
|
JaegerPropagationFormat string `json:"jaeger-propagation-format"`
|
||||||
|
|
||||||
// JaegerSamplerType specifies the sampler to be used when sampling traces.
|
// JaegerSamplerType specifies the sampler to be used when sampling traces.
|
||||||
// The available samplers are: const, probabilistic, ratelimiting, remote
|
// The available samplers are: const, probabilistic, ratelimiting, remote
|
||||||
// Default: const
|
// Default: const
|
||||||
|
@ -867,6 +870,7 @@ func NewDefault() Configuration {
|
||||||
ZipkinServiceName: "nginx",
|
ZipkinServiceName: "nginx",
|
||||||
ZipkinSampleRate: 1.0,
|
ZipkinSampleRate: 1.0,
|
||||||
JaegerCollectorPort: 6831,
|
JaegerCollectorPort: 6831,
|
||||||
|
JaegerPropagationFormat: "jaeger",
|
||||||
JaegerServiceName: "nginx",
|
JaegerServiceName: "nginx",
|
||||||
JaegerSamplerType: "const",
|
JaegerSamplerType: "const",
|
||||||
JaegerSamplerParam: "1",
|
JaegerSamplerParam: "1",
|
||||||
|
|
|
@ -1033,6 +1033,7 @@ const zipkinTmpl = `{
|
||||||
|
|
||||||
const jaegerTmpl = `{
|
const jaegerTmpl = `{
|
||||||
"service_name": "{{ .JaegerServiceName }}",
|
"service_name": "{{ .JaegerServiceName }}",
|
||||||
|
"propagation_format": "{{ .JaegerPropagationFormat }}",
|
||||||
"sampler": {
|
"sampler": {
|
||||||
"type": "{{ .JaegerSamplerType }}",
|
"type": "{{ .JaegerSamplerType }}",
|
||||||
"param": {{ .JaegerSamplerParam }},
|
"param": {{ .JaegerSamplerParam }},
|
||||||
|
|
|
@ -17,6 +17,8 @@ limitations under the License.
|
||||||
package settings
|
package settings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -33,6 +35,7 @@ const (
|
||||||
|
|
||||||
jaegerCollectorHost = "jaeger-collector-host"
|
jaegerCollectorHost = "jaeger-collector-host"
|
||||||
jaegerSamplerHost = "jaeger-sampler-host"
|
jaegerSamplerHost = "jaeger-sampler-host"
|
||||||
|
jaegerPropagationFormat = "jaeger-propagation-format"
|
||||||
// jaegerEndpoint = "jaeger-endpoint"
|
// jaegerEndpoint = "jaeger-endpoint"
|
||||||
|
|
||||||
datadogCollectorHost = "datadog-collector-host"
|
datadogCollectorHost = "datadog-collector-host"
|
||||||
|
@ -175,6 +178,36 @@ var _ = framework.IngressNginxDescribe("Configure OpenTracing", func() {
|
||||||
assert.NotContains(ginkgo.GinkgoT(), log, "Unexpected failure reloading the backend", "reloading nginx after a configmap change")
|
assert.NotContains(ginkgo.GinkgoT(), log, "Unexpected failure reloading the backend", "reloading nginx after a configmap change")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ginkgo.It("should propagate the w3c header when configured with jaeger", func() {
|
||||||
|
host := "jaeger-w3c"
|
||||||
|
config := map[string]string{}
|
||||||
|
config[enableOpentracing] = "true"
|
||||||
|
config[jaegerCollectorHost] = "127.0.0.1"
|
||||||
|
config[jaegerPropagationFormat] = "w3c"
|
||||||
|
f.SetNginxConfigMapData(config)
|
||||||
|
|
||||||
|
framework.Sleep(10 * time.Second)
|
||||||
|
log, err := f.NginxLogs()
|
||||||
|
assert.Nil(ginkgo.GinkgoT(), err, "obtaining nginx logs")
|
||||||
|
assert.NotContains(ginkgo.GinkgoT(), log, "Unexpected failure reloading the backend", "reloading nginx after a configmap change")
|
||||||
|
|
||||||
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, nil)
|
||||||
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
|
f.WaitForNginxServer(host,
|
||||||
|
func(server string) bool {
|
||||||
|
return strings.Contains(server, fmt.Sprintf("server_name %s ;", host))
|
||||||
|
})
|
||||||
|
|
||||||
|
f.HTTPTestClient().
|
||||||
|
GET("/").
|
||||||
|
WithHeader("Host", host).
|
||||||
|
Expect().
|
||||||
|
Status(http.StatusOK).
|
||||||
|
Body().
|
||||||
|
Match("traceparent=[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}")
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ginkgo.It("should enable opentracing using jaeger with an HTTP endpoint", func() {
|
ginkgo.It("should enable opentracing using jaeger with an HTTP endpoint", func() {
|
||||||
config := map[string]string{}
|
config := map[string]string{}
|
||||||
|
|
Loading…
Reference in a new issue