Skip to content

mchmarny/dapr-tracing-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dapr-tracing-demo

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

alt text

Prerequisites

  • 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

Setup

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

Run

Inside of the dapr-tracing-demo directory, start each one of the service individually:

Formatter

dapr run dist/formatter \
     --app-id formatter \
     --app-port 8082 \
     --components-path ./components \
     --log-level debug \
     --protocol http

Subscriber

dapr run dist/subscriber \
     --app-id subscriber \
     --app-port 8083 \
     --components-path ./components \
     --log-level debug \
     --protocol http

Producer

dapr run dist/producer \
     --app-id producer \
     --app-port 8081 \
     --protocol http \
     --components-path ./components \
     --log-level debug \
     --port 3500

Sender

Sender is not a Dapr service, it will serve as a target for output binding

dist/sender

Data

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"

Observability

http://localhost:9411/zipkin/

Note, if your Zipkin isn't deployed in the default namespace you will have to edit the exporterAddress in deployment/tracing/zipkin.yaml

Status

Service to service invocation

Status: ✅ Description: Trace parent populated and trace state empty as expected

traceparent: 00-6b0b8b04cfbde34f867cc52e68eaefae-7d4e118a07a9b590-00
tracestate:

Input binding

Status: ❌ Description: Expected trace parent to be populated and trace state empty

traceparent: 
tracestate:

Pubsub subscribe

Status: ✅ Description: Expected trace parent and trace state to be populated

traceparent: 00-6b0b8b04cfbde34f867cc52e68eaefae-7d4e118a07a9b590-00
tracestate:

Disclaimer

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.

License

This software is released under the Apache v2 License