The Telemetry CustomResourceDefinition (CRD) is used to define and configure policies and behaviors related to observing and collecting data in a Service Mesh (ASM) instance. It allows you to manage the telemetry features provided by Istio at fine-grained levels, such as logging, metrics, and tracing. With the Telemetry CRD, you can customize and adjust the methods for collecting and processing telemetry data based on your business requirements. This topic describes how to configure a Telemetry CRD and describes the fields in the CRD.
Configuration examples
Istio supports observability configurations at three different levels, which correspond to the following observability configurations in the ASM console:
Global configurations (the Global tab in the ASM console)
Namespace-specific configurations (the Namespace tab in the ASM console)
Workload-specific configurations (the Custom tab in the ASM console)
The following sample Telemetry YAML files demonstrate how to configure observability at different levels:
Global configurations
Namespace-specific configurations
Workload-specific configurations
Field description
Telemetry
Field | Type | Required | Description |
selector | No | Specifies the workloads for which the Telemetry policy is to be configured. | |
tracing | Tracing[] | No | Specifies the tracing behavior for all selected workloads. |
metrics | Metrics[] | No | Specifies the metrics behavior for all selected workloads. |
accessLogging | No | Specifies the access logging behavior for all selected workloads. |
Tracing
Field | Type | Required | Description |
randomSamplingPercentage | double | No | Specifies the rate at which traffic will be selected for tracing. The value 0 indicates that no sampling is performed. |
customTags | map<string, CustomTag> | No | Specifies additional custom tags added to the generated trace spans. |
Metrics
Field | Type | Required | Description |
overrides | No | Defines the custom generation method and presentation for a specific metric or all preset standard metrics. | |
providers | No | Specifies the name of providers to which the configuration applies. The value must be set to prometheus. |
AccessLogging
Field | Type | Required | Description |
disabled | bool | No | Specifies the logging behavior. |
providers | No | Specifies the name of providers to which the configuration applies. The value must be set to envoy. |
WorkloadSelector
Field | Type | Required | Description |
matchLabels | map<string, string> | No | Specifies one or more labels that indicate the set of pods or virtual machines (VMs) to which the policy applies. The scope of label search is limited to the configuration namespace in which the resource is present. |
CustomTag
Field | Type | Required | Description |
literal | No | This field adds the same, hard-coded value to each span. | |
environment | No | This field adds the value of an environment variable to each span. | |
header | No | This field adds the value of a header from the request to each span. |
MetricsOverrides
Field | Type | Required | Description |
match | No | Matches the metrics to be overridden. You need to add and configure all client and server metrics. | |
disabled | bool | No | Specifies whether to disable metric reporting. If this parameter is set to true, metric reporting is disabled. |
tagOverrides | map<string, MetricsOverrides> | No | Specifies a collection of tag names and tag expressions to override in the selected metric. |
MetricSelector
Field | Type | Required | Description |
metric | No | Specifies a metric. | |
mode | No | Specifies the mode of metrics generation. Valid values: CLIENT and SERVER. |
ProviderRef
Field | Type | Required | Description |
name | string | Yes | Specifies the name of the Telemetry provider in MeshConfig. |
Tracing.Literal
Field | Type | Required | Description |
value | string | Yes | The tag value to be used. |
Tracing.Environment
Field | Type | Required | Description |
name | string | Yes | Specifies the name of the environment variable from which the tag value is extracted. |
defaultValue | string | No | Specifies the default value that is used if the environment variable is not found. |
Tracing.RequestHeader
Field | Type | Required | Description |
name | string | Yes | Specifies the name of the header from which the tag value is extracted. |
defaultValue | string | No | Specifies the default value that is used if the header is not found. |
MetricsOverrides.TagOverride
Field | Type | Required | Description |
operation | No | Specifies whether to update, add, or remove a tag. | |
value | string | No | Specifies the tag value, which is used only when |
MetricSelector.IstioMetric
Name | Description |
REQUEST_COUNT | Counter of HTTP, HTTP/2, and gRPC requests to or from an application |
REQUEST_DURATION | Duration of HTTP, HTTP/2, and gRPC requests |
REQUEST_SIZE | Body size of HTTP, HTTP/2, and gRPC requests |
RESPONSE_SIZE | Body size of HTTP, HTTP/2, and gRPC responses |
TCP_OPENED_CONNECTIONS | Counter of TCP connections opened over the lifetime of a workload |
TCP_CLOSED_CONNECTIONS | Counter of TCP connections closed over the lifetime of a workload |
TCP_SENT_BYTES | Counter of bytes that are sent during a response over a TCP connection |
TCP_RECEIVED_BYTES | Counter of bytes that are received during a response over a TCP connection |
GRPC_REQUEST_MESSAGES | Counter of gRPC messages sent from a client |
GRPC_RESPONSE_MESSAGES | Counter of gRPC messages sent from a server |
MetricsOverrides.TagOverride.Operation
Name | Description |
UPSERT | Specifies that the tag should be inserted or updated. |
REMOVE | Specifies that the tag should not be included in the metric during the metric generation. |
WorkloadMode
Name | Description |
CLIENT | Select this value for scenarios when the workload is the source of the network traffic. |
SERVER | Select this value for scenarios when the workload is the destination of the network traffic. |
Precautions
In principle, fields that are not described in this topic are compatible between ASM and Istio of the corresponding version. The ASM console does not support editing of these fields. Therefore, if you want to use these fields, you can directly update the fields in the corresponding Telemetry custom resource (CR) by using kubectl or other methods. For more information about the fields of the Telemetry CRD, see Telemetry.