How-To: Set up Zipkin for distributed tracing
For self hosted mode, on running :
- The following YAML file is created by default in
$HOME/.dapr/config.yaml
(on Linux/Mac) or%USERPROFILE%\.dapr\config.yaml
(on Windows) and it is referenced by default ondapr run
calls unless otherwise overridden `:
- config.yaml
Launch Zipkin using Docker:
docker run -d -p 9411:9411 openzipkin/zipkin
- The applications launched with
dapr run
by default reference the config file in$HOME/.dapr/config.yaml
or and can be overridden with the Dapr CLI using the--config
param:
dapr run --app-id mynode --app-port 3000 node app.js
To view traces, in your browser go to http://localhost:9411 and you will see the Zipkin UI.
The following steps shows you how to configure Dapr to send distributed tracing data to Zipkin running as a container in your Kubernetes cluster, and how to view them.
Create a Kubernetes service for the Zipkin pod:
kubectl expose deployment zipkin --type ClusterIP --port 9411
Next, create the following YAML file locally:
- tracing.yaml configuration
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
spec:
tracing:
samplingRate: "1"
zipkin:
endpointAddress: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
Now, deploy the the Dapr configuration file:
In order to enable this configuration for your Dapr sidecar, add the following annotation to your pod spec template:
annotations:
dapr.io/config: "tracing"
To view traces, connect to the Zipkin service and open the UI:
In your browser, go to http://localhost:9411
and you will see the Zipkin UI.