Propagate Zipkin distributed tracing spans, and report spans to a Zipkin server.
The functionality of this plugin as bundled
with versions of Kong prior to 0.14.1 and Kong Enterprise prior to 0.34
differs from what is documented herein. Refer to the
You can configure this plugin using the
Kong Admin API
or through declarative configuration, which involves directly editing
the Kong configuration file.
This plugin is compatible with requests with the following protocols:
This plugin is compatible with DB-less mode.
In DB-less mode, Kong does not have an Admin API. If using this
mode, configure the plugin using declarative configuration.
Enabling the plugin on a Service
<service> is the
name of the Service that this plugin
configuration will target.
Enabling the plugin on a Route
<route> is the
name of the Route that this plugin configuration
Enabling the plugin on a Consumer
<consumer> is the
username of the Consumer that this plugin
configuration will target.
Enabling the plugin globally
A plugin which is not associated to any Service, Route, or Consumer is
considered global, and will be run on every request. Read the
Plugin Reference and the Plugin Precedence
sections for more information.
Here's a list of all the parameters which can be used in this plugin's configuration:
|The name of the plugin to use, in this case |
|The ID of the Service the plugin targets.|
|The ID of the Route the plugin targets.|
|The ID of the Consumer the plugin targets.|
|Whether this plugin will be applied.|
The full HTTP(S) endpoint to which Zipkin spans should be sent by Kong.
How often to sample requests that do not contain trace ids.
0 to turn sampling off, or to
1 to sample all requests.
The default service name to override the unknown-service-name spans.
Should the credential of the currently authenticated consumer be included in metadata sent to the Zipkin server?
The length in bytes of each request’s Trace ID.
All HTTP requests going through the plugin will be tagged with a tracing HTTP request.
This property codifies what kind of tracing header the plugin expects on incoming requests.
Possible values are
b3 option means that
the plugin expects Zipkin’s B3 multiple headers
on incoming requests, and will add them to the transmitted requests if they are missing from it.
b3-single option expects or adds Zipkin’s B3 single-header tracing headers.
w3c option expects or adds W3C’s traceparent tracing header. The
does not expect any format, and will transmit whatever header is recognized or present,
b3 if none is found. In case of mismatch between the expected and incoming
tracing headers (for example, when
header_type is set to
b3 but a w3c-style tracing header is
found in the incoming request), then the plugin will add both kinds of tracing headers
to the request and generate a mismatch warning in the logs.
How it Works
When enabled, this plugin traces requests in a way compatible with zipkin.
The code is structured around an opentracing core using the opentracing-lua library to collect timing data of a request in each of Kong’s phases.
The plugin uses opentracing-lua compatible extractor, injector, and reporters to implement Zipkin’s protocols.
An opentracing “reporter” is how tracing data is reported to another system.
This plugin records tracing data for a given request, and sends it as a batch to a Zipkin server using the Zipkin v2 API. Note that zipkin version 1.31 or higher is required.
http_endpoint configuration variable must contain the full uri including scheme, host, port and path sections (i.e. your uri likely ends in
For more information, read the Kong blog post.