Trace requests

Sample request traces to monitor the traffic and health of your service mesh.

Distributed tracing helps you track requests across multiple services in your distributed service mesh. Sampling the requests in your mesh can give you insight into request latency, serialization, and parallelism. For more information, see the Istio tracing documentation.

To get started, enable the default Envoy distributed tracing in your Istio installation to trace requests across your service mesh, analyze service dependencies and find bottlenecks or high latency services in your mesh. Then, use a tracing provider, such as Zipkin or Jaeger, to collect and visualize the sampled spans. For a list of supported tracing providers, see the Envoy documentation.

  1. Install a tracing provider in your workload cluster. For example, you might follow the Istio documentation to install Zipkin.

  2. Enable tracing when you install or update Istio. The following examples set a sampling rate of 10% of requests, add a custom host request header tag to the spans, and specify Zipkin as the default tracing provider.

    • For more information about the sampling rate, custom tag, and maximum path length settings, see the Istio tracing configuration docs.
    • For more information about setting a tracer, see the Istio meshConfig.defaultConfig.tracing reference docs.

      When you create the IstioOperator resource in the manual Istio setup or within the managed IstioLifecycleManager resource, include the following spec.meshConfig settings:

      ...
      spec:
        meshConfig:
          enableTracing: true
          defaultConfig:
            tracing:
              # Sampling rate in range of 0.0 to 100.0 with a precision of 0.01.
              # A value of 10 means that 10% of requests are sampled.
              # Default: 1
              sampling: 10
              # Add a tag to the trace span based on a literal, environment variable,
              # or client request header.
              custom_tags:
                my_tag_header:
                  header:
                    name: host
              # Specify the address of a default tracer, such as Zipkin
              zipkin:
                 address: zipkin:9411
      
      1. Save the following IstioOperator resource, and change the meshConfig settings as needed.
        apiVersion: install.istio.io/v1alpha1
        kind: IstioOperator
        metadata:
          name: tracing-update
          namespace: istio-system
        spec:
          meshConfig:
            enableTracing: true
            defaultConfig:
              tracing:
                # Sampling rate in range of 0.0 to 100.0 with a precision of 0.01.
                # A value of 10 means that 10% of requests are sampled.
                # Default: 1
                sampling: 10
                # Add a tag to the trace span based on a literal, environment variable,
                # or client request header.
                custom_tags:
                  my_tag_header:
                    header:
                      name: host
                # Specify the address of a default tracer, such as Zipkin
                zipkin:
                   address: zipkin:9411
        
      2. Update your existing installation with the resource.
        istioctl install -y --context $REMOTE_CONTEXT1 -f tracing-update.yaml
        
  3. Begin tracing the requests in your service mesh and view the sampled spans.