e.g. using docker:
sudo docker run -d -p 9411:9411 openzipkin/zipkin
curl --url http://localhost:8001/plugins/ -d name=zipkin -d config.http_endpoint=http://127.0.0.1:9411/api/v2/spans
See many more details of using this plugin at https://docs.konghq.com/plugins/zipkin/
The Zipkin plugin is derived from an OpenTracing base.
A tracer is created with the "http_headers" formatter set to use the headers described in b3-propagation
- Request span: 1 per request. Encompasses the whole request in kong (kind:
SERVER). The proxy span and balancer spans are children of this span. Contains logs/annotations for thekong.rewritephase start and end - Proxy span: 1 per request. Encompassing most of Kong's internal processing of a request (kind:
CLIENT) Contains logs/annotations for the rest start/finish of the of the Kong plugin phases:krs-kong.rewrite.startkrf-kong.rewrite.finishkas-kong.access.startkaf-kong.access.finishkbs-kong.body_filter.startkbf-kong.body_filter.finishkhs-kong.header_filter.startkhf-kong.header_filter.finishkps-kong.preread.startkpf-kong.preread.finishThis kind of information is useful for finding performance problems in plugins.
- Balancer span(s): 0 or more per request, each encompassing one balancer attempt (kind:
CLIENT) Contains tags specific to the load balancing:kong.balancer.try: a number indicating the attempt orderpeer.ipv4/peer.ipv6+peer.portfor the balanced porterror: true/false depending on whether the balancing could be done or nothttp.status_code: the http status code received, in case of errorkong.balancer.state: an nginx-specific description of the error:next/failedfor HTTP failures,0for stream failures. Equivalent tostate_namein OpenResty's Balancer'sget_last_failurefunction.
"Standard" tags are documented here Of those, this plugin currently uses:
span.kind(sent to Zipkin as "kind")http.methodhttp.status_codehttp.patherrorpeer.ipv4peer.ipv6peer.portpeer.hostnamepeer.service
In addition to the above standardised tags, this plugin also adds:
component(sent to Zipkin as "lc", for "local component")kong.api(deprecated)kong.consumerkong.credentialkong.node.idkong.routekong.servicekong.balancer.trykong.balancer.state
Logs (annotations in Zipkin) are used to encode the begin and end of every kong phase.
kong.rewrite,start/finish,<timestamp>kong.access,start/finish,<timestamp>kong.preread,start/finish,<timestamp>kong.header_filter,start/finish,<timestamp>kong.body_filter,start/finish,<timestamp>
They are transmitted to Zipkin as annotations where the value is the concatenation of the log name and the value.
For example, the kong.rewrite, start log would be transmitted as:
{ "value" = "kong.rewrite.start", timestamp = <timestamp> }