How-To: Set up Jaeger for distributed tracing

    Dapr supports the Zipkin protocol. Since Jaeger is compatible with Zipkin, the Zipkin protocol can be used to communication with Jaeger.

    The simplest way to start Jaeger is to use the pre-built all-in-one Jaeger image published to DockerHub:

    Next, create the following YAML files locally:

    • config.yaml: Note that because we are using the Zipkin protocol to talk to Jaeger, we specify the section of tracing configuration set the endpointAddress to address of the Jaeger instance.
    1. apiVersion: dapr.io/v1alpha1
    2. kind: Configuration
    3. metadata:
    4. name: tracing
    5. namespace: default
    6. spec:
    7. tracing:
    8. samplingRate: "1"
    9. zipkin:
    10. endpointAddress: "http://localhost:9412/api/v2/spans"

    To launch the application referring to the new YAML file, you can use --config option:

    1. dapr run --app-id mynode --app-port 3000 node app.js --config config.yaml

    To view traces, in your browser go to http://localhost:16686 to see the Jaeger UI.

    The following steps shows you how to configure Dapr to send distributed tracing data to Jaeger running as a container in your Kubernetes cluster, how to view them.

    Development and test

    By default, the allInOne Jaeger image uses memory as the backend storage and it is not recommended to use this in a production environment.

    Production

    Jaeger uses Elasticsearch as the backend storage, and you can create a secret in k8s cluster to access Elasticsearch server with access control. See

      1. apiVersion: jaegertracing.io/v1
      2. kind: "Jaeger"
      3. metadata:
      4. spec:
      5. strategy: production
      6. query:
      7. options:
      8. log-level: info
      9. query:
      10. base-path: /jaeger
      11. collector:
      12. maxReplicas: 5
      13. resources:
      14. limits:
      15. cpu: 500m
      16. memory: 516Mi
      17. storage:
      18. type: elasticsearch
      19. esIndexCleaner:
      20. enabled: false ## turn the job deployment on and off
      21. image: jaegertracing/jaeger-es-index-cleaner ## image of the job
      22. secretName: jaeger-secret
      23. options:
      24. es:
      25. server-urls: http://elasticsearch:9200

      The pictures are as follows, include Elasticsearch and Grafana tracing data:

      grafana

      Now, use the above YAML file to install Jaeger

      • tracing.yaml
      1. apiVersion: dapr.io/v1alpha1
      2. kind: Configuration
      3. metadata:
      4. name: tracing
      5. namespace: default
      6. spec:
      7. tracing:
      8. samplingRate: "1"
      9. zipkin:
      10. endpointAddress: "http://jaeger-collector.default.svc.cluster.local:9411/api/v2/spans"

      Finally, deploy the the Dapr component and configuration files:

      1. kubectl apply -f tracing.yaml

      In order to enable this configuration for your Dapr sidecar, add the following annotation to your pod spec template:

      That’s it! Your Dapr sidecar is now configured for use with Jaeger.

      To view traces, connect to the Jaeger Service and open the UI:

      1. kubectl port-forward svc/jaeger-query 16686

      In your browser, go to http://localhost:16686 and you will see the Jaeger UI.