Overview

Distributed tracing enables users to track a request through mesh that is distributed across multiple services. This allows a deeper understanding about request latency, serialization and parallelism via visualization.

Istio leverages Envoy’s distributed tracing feature to provide tracing integration out of the box. Specifically, Istio provides options to install various tracing backend and configure proxies to send trace spans to them automatically. See Zipkin, Jaeger and Lightstep task docs about how Istio works with those tracing systems.

Trace context propagation

Although Istio proxies are able to automatically send spans, they need some hints to tie together the entire trace. Applications need to propagate the appropriate HTTP headers so that when the proxies send span information, the spans can be correlated correctly into a single trace.

To do this, an application needs to collect and propagate the following headers from the incoming request to any outgoing requests:

  • x-request-id
  • x-b3-traceid
  • x-b3-spanid
  • x-b3-parentspanid
  • x-b3-sampled
  • x-b3-flags
  • x-ot-span-context

Additionally, tracing integrations based on OpenCensus (e.g. Stackdriver) propagate the following headers:

  • x-cloud-trace-context
  • traceparent
  • grpc-trace-bin

If you look at the sample Python productpage service, for example, you see that the application extracts the required headers from an HTTP request using OpenTracing libraries:

  1. def getForwardHeaders(request):
  2. headers = {}
  3. # x-b3-*** headers can be populated using the opentracing span
  4. span = get_current_span()
  5. carrier = {}
  6. tracer.inject(
  7. span_context=span.context,
  8. format=Format.HTTP_HEADERS,
  9. carrier=carrier)
  10. headers.update(carrier)
  11. # ...
  12. incoming_headers = ['x-request-id', 'x-datadog-trace-id', 'x-datadog-parent-id', 'x-datadog-sampled']
  13. # ...
  14. for ihdr in incoming_headers:
  15. val = request.headers.get(ihdr)
  16. if val is not None:
  17. headers[ihdr] = val
  18. return headers

The reviews application (Java) does something similar using requestHeaders:

Zip int productId,)

  1. @GET
  2. @Path("/reviews/{productId}")
  3. public Response bookReviewsById(@PathParam("productId") int productId, @Context HttpHeaders requestHeaders) {
  4. // ...
  5. if (ratings_enabled) {
  6. JsonObject ratingsResponse = getRatings(Integer.toString(productId), requestHeaders);

When you make downstream calls in your applications, make sure to include these headers.

See also

Configurability (Beta/Development)

How to configure tracing options (beta/development).

Jaeger

Learn how to configure the proxies to send tracing requests to Jaeger.

Lightstep

How to configure the proxies to send tracing requests to Lightstep.

Remotely Accessing Telemetry Addons

This task shows you how to configure external access to the set of Istio telemetry addons.

Zipkin

Learn how to configure the proxies to send tracing requests to Zipkin.

Reworking our Addon Integrations

A new way to manage installation of telemetry addons.