mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-27 08:14:18 -04:00 
			
		
		
		
	* Run gostaticheck Run gostaticcheck on the codebase and fix almost all flagged items. Only keep * coremain/run.go:192:2: var appVersion is unused (U1000) * plugin/chaos/setup.go:54:3: the surrounding loop is unconditionally terminated (SA4004) * plugin/etcd/setup.go:103:3: the surrounding loop is unconditionally terminated (SA4004) * plugin/pkg/replacer/replacer.go:274:13: argument should be pointer-like to avoid allocations (SA6002) * plugin/route53/setup.go:124:28: session.New is deprecated: Use NewSession functions to create sessions instead. NewSession has the same functionality as New except an error can be returned when the func is called instead of waiting to receive an error until a request is made. (SA1019) * test/grpc_test.go:25:69: grpc.WithTimeout is deprecated: use DialContext and context.WithTimeout instead. Will be supported throughout 1.x. (SA1019) The first one isn't true, as this is set via ldflags. The rest is minor. The deprecation should be fixed at some point; I'll file some issues. Signed-off-by: Miek Gieben <miek@miek.nl> * Make sure to plug in the plugins import the plugins, that file that did this was removed, put it in the reload test as this requires an almost complete coredns server. Signed-off-by: Miek Gieben <miek@miek.nl>
trace
Name
trace - enables OpenTracing-based tracing of DNS requests as they go through the plugin chain.
Description
With trace you enable OpenTracing of how a request flows through CoreDNS.
Syntax
The simplest form is just:
trace [ENDPOINT-TYPE] [ENDPOINT]
- ENDPOINT-TYPE is the type of tracing destination. Currently only zipkinanddatadogare supported. Defaults tozipkin.
- ENDPOINT is the tracing destination, and defaults to localhost:9411. For Zipkin, if ENDPOINT does not begin withhttp, then it will be transformed tohttp://ENDPOINT/api/v1/spans.
With this form, all queries will be traced.
Additional features can be enabled with this syntax:
trace [ENDPOINT-TYPE] [ENDPOINT] {
	every AMOUNT
	service NAME
	client_server
}
- everyAMOUNT will only trace one query of each AMOUNT queries. For example, to trace 1 in every 100 queries, use AMOUNT of 100. The default is 1.
- serviceNAME allows you to specify the service name reported to the tracing server. Default is- coredns.
- client_serverwill enable the- ClientServerSameSpanOpenTracing feature.
Zipkin
You can run Zipkin on a Docker host like this:
docker run -d -p 9411:9411 openzipkin/zipkin
Examples
Use an alternative Zipkin address:
trace tracinghost:9253
or
. {
    trace zipkin tracinghost:9253
}
If for some reason you are using an API reverse proxy or something and need to remap the standard Zipkin URL you can do something like:
trace http://tracinghost:9411/zipkin/api/v1/spans
Using DataDog:
trace datadog localhost:8125
Trace one query every 10000 queries, rename the service, and enable same span:
trace tracinghost:9411 {
	every 10000
	service dnsproxy
	client_server
}