Distributed Tracing
segmentio/kafka-go has no support for open telemetry.
There is also an issue about it.
Based on some work on that issue, we created a project called otel-kafka-konsumer.
By integrating this project with kafka-konsumer, we successfully implemented distributed tracing in consuming
and producing operations. You can run demo.
In this demo, we chose jaeger to show how to integrate distributed tracing on your project using kafka-konsumer.
But zipkin, stdout, and other alternatives are still applicable
Two settings are significant.
- trace.TracerProvider (you can set jaeger,zipkin etc.)
- propagation.TextMapPropagator (please refer to here)
If you have not specified its values, kafka-konsumer uses global.TraceProvider and Propagation.
Demo overview
How to run demo?
You should run docker-compose.yml by
docker-compose up build
You can access the jaeger dashboard as jaeger dashboard
You can run the demo as go run main.go
In the producing step, we open only two spans. In the consuming step, we open three spans. You can see their relationship via the jeager dashboard, as shown below.