Telemetry

Telemetry defines how the telemetry is generated for workloads within a mesh.

For mesh level configuration, put the resource in root configuration namespace for your Istio installation without a workload selector.

For any namespace, including the root configuration namespace, it is only valid to have a single workload selector-less Telemetry resource.

For resources with a workload selector, it is only valid to have one resource selecting any given workload.

The hierarchy of Telemetry configuration is as follows:

  1. Workload-specific configuration
  2. Namespace-specific configuration
  3. Root namespace configuration

Examples:

Policy to enable random sampling for 10% of traffic:

  1. apiVersion: telemetry.istio.io/v1alpha1
  2. kind: Telemetry
  3. metadata:
  4. name: mesh-default
  5. namespace: istio-system
  6. spec:
  7. # no selector specified, applies to all workloads
  8. tracing:
  9. - randomSamplingPercentage: 10.00

Policy to disable trace reporting for the “foo” workload (note: tracing context will still be propagated):

  1. apiVersion: telemetry.istio.io/v1alpha1
  2. kind: Telemetry
  3. metadata:
  4. name: foo-tracing
  5. namespace: bar
  6. spec:
  7. selector:
  8. matchLabels:
  9. service.istio.io/canonical-name: foo
  10. tracing:
  11. - disableSpanReporting: true

Policy to select the alternate zipkin provider for trace reporting:

  1. apiVersion: telemetry.istio.io/v1alpha1
  2. kind: Telemetry
  3. metadata:
  4. name: foo-tracing-alternate
  5. namespace: baz
  6. spec:
  7. selector:
  8. matchLabels:
  9. service.istio.io/canonical-name: foo
  10. tracing:
  11. - providers:
  12. - name: "zipkin-alternate"
  13. randomSamplingPercentage: 10.00

Policy to add a custom tag from a literal value:

  1. apiVersion: telemetry.istio.io/v1alpha1
  2. kind: Telemetry
  3. metadata:
  4. name: mesh-default
  5. namespace: istio-system
  6. spec:
  7. # no selector specified, applies to all workloads
  8. tracing:
  9. - randomSamplingPercentage: 10.00
  10. customTags:
  11. my_new_foo_tag:
  12. literal:
  13. value: "foo"

Policy to disable server-side metrics for Stackdriver for an entire mesh:

  1. apiVersion: telemetry.istio.io/v1alpha1
  2. kind: Telemetry
  3. metadata:
  4. name: mesh-default
  5. namespace: istio-system
  6. spec:
  7. # no selector specified, applies to all workloads
  8. metrics:
  9. - providers:
  10. - name: stackdriver
  11. overrides:
  12. - match:
  13. metric: ALL_METRICS
  14. mode: SERVER
  15. disabled: true

Policy to add dimensions to all Prometheus metrics for the foo namespace:

  1. apiVersion: telemetry.istio.io/v1alpha1
  2. kind: Telemetry
  3. metadata:
  4. name: namespace-metrics
  5. namespace: foo
  6. spec:
  7. # no selector specified, applies to all workloads in the namespace
  8. metrics:
  9. - providers:
  10. - name: prometheus
  11. overrides:
  12. # match clause left off matches all istio metrics, client and server
  13. - tagOverrides:
  14. request_method:
  15. value: "request.method"
  16. request_host:
  17. value: "request.host"

Policy to remove the response_code dimension on some Prometheus metrics for the bar.foo workload:

  1. apiVersion: telemetry.istio.io/v1alpha1
  2. kind: Telemetry
  3. metadata:
  4. name: remove-response-code
  5. namespace: foo
  6. spec:
  7. selector:
  8. matchLabels:
  9. service.istio.io/canonical-name: bar
  10. metrics:
  11. - providers:
  12. - name: prometheus
  13. overrides:
  14. - match:
  15. metric: REQUEST_COUNT
  16. tagOverrides:
  17. response_code:
  18. operation: REMOVE
  19. - match:
  20. metric: REQUEST_DURATION
  21. tagOverrides:
  22. response_code:
  23. operation: REMOVE
  24. - match:
  25. metric: REQUEST_SIZE
  26. tagOverrides:
  27. response_code:
  28. operation: REMOVE
  29. - match:
  30. metric: RESPONSE_SIZE
  31. tagOverrides:
  32. response_code:
  33. operation: REMOVE

Policy to enable access logging for the entire mesh:

  1. apiVersion: telemetry.istio.io/v1alpha1
  2. kind: Telemetry
  3. metadata:
  4. name: mesh-default
  5. namespace: istio-system
  6. spec:
  7. # no selector specified, applies to all workloads
  8. accessLogging:
  9. - providers:
  10. - name: envoy
  11. # By default, this turns on access logging (no need to set `disabled: false`).
  12. # Unspecified `disabled` will be treated as `disabled: false`, except in
  13. # cases where a parent configuration has marked as `disabled: true`. In
  14. # those cases, `disabled: false` must be set explicitly to override.

Policy to disable access logging for the foo namespace:

  1. apiVersion: telemetry.istio.io/v1alpha1
  2. kind: Telemetry
  3. metadata:
  4. name: namespace-no-log
  5. namespace: foo
  6. spec:
  7. # no selector specified, applies to all workloads in the namespace
  8. accessLogging:
  9. - disabled: true

Telemetry

FieldTypeDescriptionRequired
selectorWorkloadSelector

Optional. The selector decides where to apply the Telemetry policy. If not set, the Telemetry policy will be applied to all workloads in the same namespace as the Telemetry policy.

No
tracingTracing[]

Optional. Tracing configures the tracing behavior for all selected workloads.

No
metricsMetrics[]

Optional. Metrics configure the metrics behavior for all selected workloads.

No
accessLoggingAccessLogging[]

Optional. AccessLogging configures the access logging behavior for all selected workloads.

No

Tracing

Tracing configures tracing behavior for workloads within a mesh. It can be used to enable/disable tracing, as well as to set sampling rates and custom tag extraction.

Tracing configuration support overrides of the fields providers, random_sampling_percentage, disable_span_reporting, and custom_tags at each level in the configuration hierarchy, with missing values filled in from parent resources. However, when specified, custom_tags will fully replace any values provided by parent configuration.

FieldTypeDescriptionRequired
matchTracingSelector

Allows tailoring of behavior to specific conditions.

No
providersProviderRef[]

Optional. Name of provider(s) to use for span reporting. If a provider is not specified, the default tracing provider will be used. NOTE: At the moment, only a single provider can be specified in a given Tracing rule.

No
randomSamplingPercentageDoubleValue

Controls the rate at which traffic will be selected for tracing if no prior sampling decision has been made. If a prior sampling decision has been made, that decision will be respected. However, if no sampling decision has been made (example: no x-b3-sampled tracing header was present in the requests), the traffic will be selected for telemetry generation at the percentage specified.

Defaults to 0%. Valid values [0.00-100.00]. Can be specified in 0.01% increments.

No
disableSpanReportingBoolValue

Controls span reporting. If set to true, no spans will be reported for impacted workloads. This does NOT impact context propagation or trace sampling behavior.

No
customTagsmap<string, CustomTag>

Optional. Configures additional custom tags to the generated trace spans.

No

ProviderRef

Used to bind Telemetry configuration to specific providers for targeted customization.

FieldTypeDescriptionRequired
namestring

Required. Name of Telemetry provider in MeshConfig.

Yes

Metrics

Metrics defines the workload-level overrides for metrics generation behavior within a mesh. It can be used to enable/disable metrics generation, as well as to customize the dimensions of the generated metrics.

FieldTypeDescriptionRequired
providersProviderRef[]

Optional. Name of providers to which this configuration should apply. If a provider is not specified, the default metrics provider will be used.

No
overridesMetricsOverrides[]

Optional. Ordered list of overrides to metrics generation behavior.

Specified overrides will be applied in order. They will be applied on top of inherited overrides from other resources in the hierarchy in the following order:

  1. Mesh-scoped overrides
  2. Namespace-scoped overrides
  3. Workload-scoped overrides

Because overrides are applied in order, users are advised to order their overrides from least specific to most specific matches. That is, it is a best practice to list any universal overrides first, with tailored overrides following them.

No
reportingIntervalDuration

Optional. Reporting interval allows configuration of the time between calls out to for metrics reporting. This currently only supports TCP metrics but we may use this for long duration HTTP streams in the future. The default duration is 5s.

No

MetricSelector

Provides a mechanism for matching metrics for the application of override behaviors.

FieldTypeDescriptionRequired
metricIstioMetric (oneof)

One of the well-known Istio Standard Metrics.

No
customMetricstring (oneof)

Allows free-form specification of a metric. No validation of custom metrics is provided.

No
modeWorkloadMode

Controls which mode of metrics generation is selected: CLIENT and/or SERVER.

No

MetricsOverrides

MetricsOverrides defines custom metric generation behavior for an individual metric or the set of all standard metrics.

FieldTypeDescriptionRequired
matchMetricSelector

Match allows provides the scope of the override. It can be used to select individual metrics, as well as the workload modes (server and/or client) in which the metrics will be generated.

If match is not specified, the overrides will apply to all metrics for both modes of operation (client and server).

No
disabledBoolValue

Optional. Must explicitly set this to “true” to turn off metrics reporting for the listed metrics. If disabled has been set to “true” in a parent configuration, it must explicitly be set to “false” to turn metrics reporting on in the workloads selected by the Telemetry resource.

No
tagOverridesmap<string, TagOverride>

Optional. Collection of tag names and tag expressions to override in the selected metric(s). The key in the map is the name of the tag. The value in the map is the operation to perform on the the tag. WARNING: some providers may not support adding/removing tags. See also: https://istio.io/latest/docs/reference/config/metrics/#labels

No

AccessLogging

Access logging defines the workload-level overrides for access log generation. It can be used to select provider or enable/disable access log generation for a workload.

FieldTypeDescriptionRequired
matchLogSelector

Allows tailoring of logging behavior to specific conditions.

No
providersProviderRef[]

Optional. Name of providers to which this configuration should apply. If a provider is not specified, the default logging provider will be used.

No
disabledBoolValue

Controls logging. If set to true, no access logs will be generated for impacted workloads (for the specified providers). NOTE: currently default behavior will be controlled by the provider(s) selected above. Customization controls will be added to this API in future releases.

No
filterFilter

Optional. If specified, this filter will be used to select specific requests/connections for logging.

No

Tracing.TracingSelector

TracingSelector provides a coarse-grained ability to configure tracing behavior based on certain traffic metadata (such as traffic direction).

FieldTypeDescriptionRequired
modeWorkloadMode

This determines whether or not to apply the tracing configuration based on the direction of traffic relative to the proxied workload.

No

Tracing.CustomTag

CustomTag defines a tag to be added to a trace span that is based on an operator-supplied value. This value can either be a hard-coded value, a value taken from an environment variable known to the sidecar proxy, or from a request header.

NOTE: when specified, custom_tags will fully replace any values provided by parent configuration.

FieldTypeDescriptionRequired
literalLiteral (oneof)

Literal adds the same, hard-coded value to each span.

No
environmentEnvironment (oneof)

Environment adds the value of an environment variable to each span.

No
headerRequestHeader (oneof)

RequestHeader adds the value of an header from the request to each span.

No

Tracing.Literal

FieldTypeDescriptionRequired
valuestring

The tag value to use.

No

Tracing.Environment

FieldTypeDescriptionRequired
namestring

Name of the environment variable from which to extract the tag value.

No
defaultValuestring

Optional. If the environment variable is not found, this value will be used instead.

No

Tracing.RequestHeader

FieldTypeDescriptionRequired
namestring

Name of the header from which to extract the tag value.

No
defaultValuestring

Optional. If the header is not found, this value will be used instead.

No

MetricsOverrides.TagOverride

TagOverride specifies an operation to perform on a metric dimension (also known as a label). Tags may be added, removed, or have their default values overridden.

FieldTypeDescriptionRequired
operationOperation

Operation controls whether or not to update/add a tag, or to remove it.

No
valuestring

Value is only considered if the operation is UPSERT. Values are CEL expressions over attributes. Examples include: “string(destination.port)” and “request.host”. Istio exposes all standard Envoy attributes. Additionally, Istio exposes node metadata as attributes. More information is provided in the customization docs.

No

AccessLogging.LogSelector

LogSelector provides a coarse-grained ability to configure logging behavior based on certain traffic metadata (such as traffic direction). LogSelector applies to traffic metadata which is not represented in the attribute set currently supported by Filters. It allows control planes to limit the configuration sent to individual workloads. Finer-grained logging behavior can be further configured via filter.

FieldTypeDescriptionRequired
modeWorkloadMode

This determines whether or not to apply the access logging configuration based on the direction of traffic relative to the proxied workload.

No

AccessLogging.Filter

Allows specification of an access log filter.

FieldTypeDescriptionRequired
expressionstring

CEL expression for selecting when requests/connections should be logged.

Examples:

  • response.code >= 400
  • connection.mtls && request.url_path.contains(‘v1beta3’)
No

MetricSelector.IstioMetric

Curated list of known metric types that is supported by Istio metric providers. See also: https://istio.io/latest/docs/reference/config/metrics/#metrics

NameDescription
ALL_METRICS

Use of this enum indicates that the override should apply to all Istio default metrics.

REQUEST_COUNT

Counter of requests to/from an application, generated for HTTP, HTTP/2, and GRPC traffic.

The Prometheus provider exports this metric as: istio_requests_total.

The Stackdriver provider exports this metric as:

  • istio.io/service/server/request_count (SERVER mode)
  • istio.io/service/client/request_count (CLIENT mode)
REQUEST_DURATION

Histogram of request durations, generated for HTTP, HTTP/2, and GRPC traffic.

The Prometheus provider exports this metric as: istio_request_duration_milliseconds.

The Stackdriver provider exports this metric as:

  • istio.io/service/server/response_latencies (SERVER mode)
  • istio.io/service/client/roundtrip_latencies (CLIENT mode)
REQUEST_SIZE

Histogram of request body sizes, generated for HTTP, HTTP/2, and GRPC traffic.

The Prometheus provider exports this metric as: istio_request_bytes.

The Stackdriver provider exports this metric as:

  • istio.io/service/server/request_bytes (SERVER mode)
  • istio.io/service/client/request_bytes (CLIENT mode)
RESPONSE_SIZE

Histogram of response body sizes, generated for HTTP, HTTP/2, and GRPC traffic.

The Prometheus provider exports this metric as: istio_response_bytes.

The Stackdriver provider exports this metric as:

  • istio.io/service/server/response_bytes (SERVER mode)
  • istio.io/service/client/response_bytes (CLIENT mode)
TCP_OPENED_CONNECTIONS

Counter of TCP connections opened over lifetime of workload.

The Prometheus provider exports this metric as: istio_tcp_connections_opened_total.

The Stackdriver provider exports this metric as:

  • istio.io/service/server/connection_open_count (SERVER mode)
  • istio.io/service/client/connection_open_count (CLIENT mode)
TCP_CLOSED_CONNECTIONS

Counter of TCP connections closed over lifetime of workload.

The Prometheus provider exports this metric as: istio_tcp_connections_closed_total.

The Stackdriver provider exports this metric as:

  • istio.io/service/server/connection_close_count (SERVER mode)
  • istio.io/service/client/connection_close_count (CLIENT mode)
TCP_SENT_BYTES

Counter of bytes sent during a response over a TCP connection.

The Prometheus provider exports this metric as: istio_tcp_sent_bytes_total.

The Stackdriver provider exports this metric as:

  • istio.io/service/server/sent_bytes_count (SERVER mode)
  • istio.io/service/client/sent_bytes_count (CLIENT mode)
TCP_RECEIVED_BYTES

Counter of bytes received during a request over a TCP connection.

The Prometheus provider exports this metric as: istio_tcp_received_bytes_total.

The Stackdriver provider exports this metric as:

  • istio.io/service/server/received_bytes_count (SERVER mode)
  • istio.io/service/client/received_bytes_count (CLIENT mode)
GRPC_REQUEST_MESSAGES

Counter incremented for every gRPC messages sent from a client.

The Prometheus provider exports this metric as: istio_request_messages_total

GRPC_RESPONSE_MESSAGES

Counter incremented for every gRPC messages sent from a server.

The Prometheus provider exports this metric as: istio_response_messages_total

MetricsOverrides.TagOverride.Operation

NameDescription
UPSERT

Insert or Update the tag with the provided value expression. The value field MUST be specified if UPSERT is used as the operation.

REMOVE

Specifies that the tag should not be included in the metric when generated.

WorkloadMode

WorkloadMode allows selection of the role of the underlying workload in network traffic. A workload is considered as acting as a SERVER if it is the destination of the traffic (that is, traffic direction, from the perspective of the workload is inbound). If the workload is the source of the network traffic, it is considered to be in CLIENT mode (traffic is outbound from the workload).

NameDescription
CLIENT_AND_SERVER

Selects for scenarios when the workload is either the source or destination of the network traffic.

CLIENT

Selects for scenarios when the workload is the source of the network traffic.

SERVER

Selects for scenarios when the workload is the destination of the network traffic.