diff --git a/man/coredns-trace.7 b/man/coredns-trace.7 index 4a404aa30..47484564e 100644 --- a/man/coredns-trace.7 +++ b/man/coredns-trace.7 @@ -1,9 +1,9 @@ -.\" Generated by Mmark Markdown Processer - mmark.miek.nl +.\" Generated by Mmark Markdown Processor - mmark.miek.nl .TH "COREDNS-TRACE" 7 "October 2026" "CoreDNS" "CoreDNS Plugins" .SH "NAME" .PP -\fItrace\fP - enables OpenTracing-based tracing of DNS requests as they go through the plugin chain. +\fItrace\fP \- enables OpenTracing\-based tracing of DNS requests as they go through the plugin chain. .SH "DESCRIPTION" .PP @@ -24,11 +24,12 @@ trace [ENDPOINT\-TYPE] [ENDPOINT] .RE .IP \(bu 4 -\fBENDPOINT-TYPE\fP is the type of tracing destination. Currently only \fB\fCzipkin\fR and \fB\fCdatadog\fR are supported. +\fBENDPOINT\-TYPE\fP is the type of tracing destination. Currently only \fB\fCzipkin\fR and \fB\fCdatadog\fR are supported. Defaults to \fB\fCzipkin\fR. .IP \(bu 4 \fBENDPOINT\fP is the tracing destination, and defaults to \fB\fClocalhost:9411\fR. For Zipkin, if -\fBENDPOINT\fP does not begin with \fB\fChttp\fR, then it will be transformed to \fB\fChttp://ENDPOINT/api/v2/spans\fR. +\fBENDPOINT\fP does not begin with \fB\fChttp://\fR or \fB\fChttps://\fR (case\-insensitive), then it will be transformed to +\fB\fChttp://ENDPOINT/api/v2/spans\fR. .PP @@ -66,7 +67,7 @@ Default is \fB\fCcoredns\fR. \fB\fCdatadog_analytics_rate\fR \fBRATE\fP will enable trace analytics \[la]https://docs.datadoghq.com/tracing/app_analytics\[ra] on the traces sent from \fI0\fP to \fI1\fP, \fI1\fP being every trace sent will be analyzed. This is a datadog only feature -(\fBENDPOINT-TYPE\fP needs to be \fB\fCdatadog\fR) +(\fBENDPOINT\-TYPE\fP needs to be \fB\fCdatadog\fR) .IP \(bu 4 \fB\fCzipkin_max_backlog_size\fR configures the maximum backlog size for Zipkin HTTP reporter. When batch size reaches this threshold, spans from the beginning of the batch will be disposed. Default is 1000 backlog size. diff --git a/plugin/trace/README.md b/plugin/trace/README.md index 960c51718..bebe0f091 100644 --- a/plugin/trace/README.md +++ b/plugin/trace/README.md @@ -20,7 +20,8 @@ trace [ENDPOINT-TYPE] [ENDPOINT] * **ENDPOINT-TYPE** is the type of tracing destination. Currently only `zipkin` and `datadog` are supported. Defaults to `zipkin`. * **ENDPOINT** is the tracing destination, and defaults to `localhost:9411`. For Zipkin, if - **ENDPOINT** does not begin with `http`, then it will be transformed to `http://ENDPOINT/api/v2/spans`. + **ENDPOINT** does not begin with `http://` or `https://` (case-insensitive), then it will be transformed to + `http://ENDPOINT/api/v2/spans`. With this form, all queries will be traced. diff --git a/plugin/trace/setup.go b/plugin/trace/setup.go index c3b07ebb9..6c44a5a3d 100644 --- a/plugin/trace/setup.go +++ b/plugin/trace/setup.go @@ -148,7 +148,8 @@ func normalizeEndpoint(epType, ep string) (string, string, error) { } if epType == "zipkin" { - if !strings.Contains(ep, "http") { + lowerEp := strings.ToLower(ep) + if !strings.HasPrefix(lowerEp, "http://") && !strings.HasPrefix(lowerEp, "https://") { ep = "http://" + ep + "/api/v2/spans" } } diff --git a/plugin/trace/setup_test.go b/plugin/trace/setup_test.go index cfe444a4c..3f486cbed 100644 --- a/plugin/trace/setup_test.go +++ b/plugin/trace/setup_test.go @@ -23,6 +23,14 @@ func TestTraceParse(t *testing.T) { // oks {`trace`, false, "http://localhost:9411/api/v2/spans", 1, `coredns`, false, 0, 0, 0}, {`trace localhost:1234`, false, "http://localhost:1234/api/v2/spans", 1, `coredns`, false, 0, 0, 0}, + {`trace zipkin-http.monitoring:9411`, false, "http://zipkin-http.monitoring:9411/api/v2/spans", 1, `coredns`, false, 0, 0, 0}, + {`trace zipkin http-collector:9411`, false, "http://http-collector:9411/api/v2/spans", 1, `coredns`, false, 0, 0, 0}, + {`trace zipkin myhttpscollector:9411`, false, "http://myhttpscollector:9411/api/v2/spans", 1, `coredns`, false, 0, 0, 0}, + {`trace zipkin https://zipkin-http.monitoring:9411/custom/spans`, false, "https://zipkin-http.monitoring:9411/custom/spans", 1, `coredns`, false, 0, 0, 0}, + {`trace HTTP://collector:9411/api/v2/spans`, false, "HTTP://collector:9411/api/v2/spans", 1, `coredns`, false, 0, 0, 0}, + {`trace zipkin HTTPS://collector:9411/api/v2/spans`, false, "HTTPS://collector:9411/api/v2/spans", 1, `coredns`, false, 0, 0, 0}, + {`trace zipkin HtTpS://collector:9411/Custom/Spans?Tenant=Blue`, false, "HtTpS://collector:9411/Custom/Spans?Tenant=Blue", 1, `coredns`, false, 0, 0, 0}, + {`trace zipkin httpS://collector:9411/Custom/Spans?Tenant=Blue`, false, "httpS://collector:9411/Custom/Spans?Tenant=Blue", 1, `coredns`, false, 0, 0, 0}, {`trace http://localhost:1234/somewhere/else`, false, "http://localhost:1234/somewhere/else", 1, `coredns`, false, 0, 0, 0}, {`trace zipkin localhost:1234`, false, "http://localhost:1234/api/v2/spans", 1, `coredns`, false, 0, 0, 0}, {`trace datadog localhost`, false, "localhost", 1, `coredns`, false, 0, 0, 0},