The infrastructure makes it possible to trace all actions across different services and components. This is implemented using Istio and OpenTracing with Jaeger.
Header Propagation
For all containers deployed on the infrastructure, an istio-sidecar proxy is deployed in the same pod. The istio proxy are able to automatically send spans (the time spend in a single service) to Jaeger.
But to be able to correlate the spans to an entire trace we need to propagate the appropriate HTTP headers.
The headers that must be propagated from the incoming request to all outgoing requests are the following:
x-request-id
x-b3-traceid
x-b3-spanid
x-b3-parentspanid
x-b3-sampled
x-b3-flags
x-ot-span-context
- b3 (for forward compatibility)
All headers may not be present for all requests, but if they are, then they must be propagated.
Calling external dependencies
If an application deployed on the ehealth-platform infrastructure makes a call to an external dependency, this call should also have the tracing headers on.
This allows the infrastructure to:
- Pinpoint potentially slow external dependencies
- Calculate how much time is spend waiting for external dependencies for each end-user request
- Create audit trails for all requests
More Info
Java client library and great explanation of the different B3 headers: https://github.com/openzipkin/b3-propagation
Istio documentation of distributed tracing using headers propagation: https://istio.io/docs/tasks/telemetry/distributed-tracing/.
Alternative Java library: https://github.com/jaegertracing/jaeger-client-java
Example