Dapr tracing demo integrating multiple self-container microservices (no dependencies) to illustrate end-to-end tracing where the tracing headers are being propagated across:
- service to service invocation
- input binding
- state operation
- pubsub subscribe
- output binding
- To run this demo locally, you will have to install Dapr.
- Additionally to view the resulting traces you will need Zipkin. Instructions on how to setup Zipkin for Dapr are here
Assuming you have all the prerequisites mentioned above, first, start by cloning this repo:
git clone https://github.com/mchmarny/dapr-tracing-demo.git
navigate into the dapr-tracing-demo
directory
cd dapr-tracing-demo
and build the executables for your OS
bin/build
You should see now 4 files in the dist directory: producer
, formatter
, subscriber
, sender
Inside of the dapr-tracing-demo
directory, start each one of the service individually:
dapr run dist/formatter \
--app-id formatter \
--app-port 8082 \
--components-path ./components \
--log-level debug \
--protocol http
dapr run dist/subscriber \
--app-id subscriber \
--app-port 8083 \
--components-path ./components \
--log-level debug \
--protocol http
dapr run dist/producer \
--app-id producer \
--app-port 8081 \
--protocol http \
--components-path ./components \
--log-level debug \
--port 3500
Sender is not a Dapr service, it will serve as a target for output binding
dist/sender
Now that all the services are running, send data by posting data to Dapr for the receive
input binding
curl -X POST -d '{ "data": {"id":"1", "txt":"test"}, "operation": "create" }' \
-H "Content-type: application/json" \
"http://localhost:3500/v1.0/bindings/receive"
Note, if your Zipkin isn't deployed in the
default
namespace you will have to edit theexporterAddress
in deployment/tracing/zipkin.yaml
Status: ✅ Description: Trace parent populated and trace state empty as expected
traceparent: 00-6b0b8b04cfbde34f867cc52e68eaefae-7d4e118a07a9b590-00
tracestate:
Status: ❌ Description: Expected trace parent to be populated and trace state empty
traceparent:
tracestate:
Status: ✅ Description: Expected trace parent and trace state to be populated
traceparent: 00-6b0b8b04cfbde34f867cc52e68eaefae-7d4e118a07a9b590-00
tracestate:
This is my personal project and it does not represent my employer. I take no responsibility for issues caused by this code. I do my best to ensure that everything works, but if something goes wrong, my apologies is all you will get.
This software is released under the Apache v2 License