Skip to main content

Zipkin Plugin

Updated Mar 15, 2025 ·

Overview

Zipkin is an open-source distributed tracing system that helps collect timing data for requests across multiple services, enabling better monitoring and debugging.

  • Tracks the flow of requests across microservices.
  • Helps visualize and identify latency bottlenecks in distributed systems.

The Zipkin plugin in Kong enables distributed tracing by forwarding trace data to a Zipkin server. This improves visibility into API and microservice performance and helps identify and optimize latency issues.

Lab Environment

This lab tests a Kong API Gateway deployment using a FastAPI endpoint. To simplify, both the containerized Kong API Gateway and the FastAPI endpoint are installed locally on a Windows 10 machine. A Docker Compose file is used to deploy Kong, along with other applications like Prometheus, Zipkin, the ELK Stack, and more.

info

Make sure that you have installed Docker Desktop.

Simply installing Docker in WSL2 without Docker Desktop may introduce some issue when configuring the communication between the containerized Kong API Gateway and the FastAPI application that is installed on the local host.

Pre-requisites

Enable the Zipkin Plugin

Login to the Kong Manager OSS UI and go to Plugins > New Plugin > Analytics & Monitoring > Zipkin. Configure the following:

FieldValue
Http Endpointhttp://host.docker.internal:9411/api/v2/spans
Sample Ratio1
info

Sample ratio - Out of 100 requests, how many percentage will Zipkin monitor. If it is set to 1, then it means all of the request will be monitored.

Click Save. It should now show on the Plugins list.

Generate Requests

Setup Postman

To setup Postman, please see Testing with Postman

Open Postman and create a folder called Logstash. Right-click on the this folder and create a new GET request called Prometheus Plugin. Use this URL for the API request:

http://localhost:8000/kong/healthy 

Right-click on the Logstash folder > Run folder. Then set Iterations to 1000. Click Run Kong.

This will automatically create a loop and run the API requests 1000 times.

info

For this to work, you need to have the FastAPI Endpoint setup and the routes and gateway services must be configured.

Test in Zipkin

Open a web browser and navigate to the Zipkin page

http://localhost:9411/zipkin/

Click Run Query. It should show the trace for a request that was processed by Kong. This is also the root, which serves as a starting point of a trace. A trace in Zipkin is a record of the journey that a request takes through various services in a microservices architecture.

Click on the trace to see more details.

This trace shows that a GET request was sent to Kong API Gateway, which then routed it to the fastapi-service. The trace indicates that Kong processed the request in 82ms, with annotations marking the start and end of the client interaction. The span shows that Kong used a load balancer, and the fastapi-service responded to the request.

Going back to the main page, we can see more traces.