Telemetry
Telemetry
defines how telemetry (metrics, logs and traces)
is generated for workloads within a mesh.
The hierarchy of Telemetry configuration is as follows:
- Workload-specific configuration
- Namespace-specific configuration
- Root namespace configuration
For mesh level configuration, put a resource in the 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.
Gateways and waypoints are targeted for telemetry configuration
using the targetRefs
field.
Examples:
Enable random sampling for 10% of traffic:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: mesh-default
namespace: istio-system
spec:
# no selector specified, applies to all workloads
tracing:
- randomSamplingPercentage: 10.00
Disable trace reporting for the foo
workload
(note: tracing context will still be propagated):
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: foo-tracing
namespace: bar
spec:
selector:
matchLabels:
service.istio.io/canonical-name: foo
tracing:
- disableSpanReporting: true
Select a named tracing provider for trace reporting:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: foo-tracing-alternate
namespace: baz
spec:
selector:
matchLabels:
service.istio.io/canonical-name: foo
tracing:
- providers:
- name: "zipkin-alternate"
randomSamplingPercentage: 10.00
Tailor the “zipkin” provider to sample traces from client workloads only:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: mesh-default
namespace: istio-system
spec:
# no selector specified, applies to all workloads
tracing:
- match: CLIENT
- providers:
- name: "zipkin"
Add a custom tag from a literal value:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: mesh-default
namespace: istio-system
spec:
# no selector specified, applies to all workloads
tracing:
- randomSamplingPercentage: 10.00
customTags:
my_new_foo_tag:
literal:
value: "foo"
Disable server-side metrics for Prometheus for an entire mesh:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: mesh-default
namespace: istio-system
spec:
# no selector specified, applies to all workloads
metrics:
- providers:
- name: prometheus
overrides:
- match:
metric: ALL_METRICS
mode: SERVER
disabled: true
Add dimensions to all Prometheus metrics for the foo
namespace:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: namespace-metrics
namespace: foo
spec:
# no selector specified, applies to all workloads in the namespace
metrics:
- providers:
- name: prometheus
overrides:
# match clause left off matches all istio metrics, client and server
- tagOverrides:
request_method:
value: "request.method"
request_host:
value: "request.host"
Remove the response_code
dimension on some Prometheus metrics for
the bar.foo
workload:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: remove-response-code
namespace: foo
spec:
selector:
matchLabels:
service.istio.io/canonical-name: bar
metrics:
- providers:
- name: prometheus
overrides:
- match:
metric: REQUEST_COUNT
tagOverrides:
response_code:
operation: REMOVE
- match:
metric: REQUEST_DURATION
tagOverrides:
response_code:
operation: REMOVE
- match:
metric: REQUEST_SIZE
tagOverrides:
response_code:
operation: REMOVE
- match:
metric: RESPONSE_SIZE
tagOverrides:
response_code:
operation: REMOVE
Enable access logging for the entire mesh:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: mesh-default
namespace: istio-system
spec:
# no selector specified, applies to all workloads
accessLogging:
- providers:
- name: envoy
# By default, this turns on access logging (no need to set `disabled: false`).
# Unspecified `disabled` will be treated as `disabled: false`, except in
# cases where a parent configuration has marked as `disabled: true`. In
# those cases, `disabled: false` must be set explicitly to override.
Disable access logging for the foo
namespace:
apiVersion: telemetry.istio.io/v1
kind: Telemetry
metadata:
name: namespace-no-log
namespace: foo
spec:
# no selector specified, applies to all workloads in the namespace
accessLogging:
- disabled: true
Telemetry
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.
TracingSelector
TracingSelector provides a coarse-grained ability to configure tracing behavior based on certain traffic metadata (such as traffic direction).
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.
Literal
Environment
RequestHeader
ProviderRef
Used to bind Telemetry configuration to specific providers for targeted customization.
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.
MetricSelector
Provides a mechanism for matching metrics for the application of override behaviors.
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
Name | Description |
---|---|
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: The Stackdriver provider exports this metric as:
|
REQUEST_DURATION | Histogram of request durations, generated for HTTP, HTTP/2, and GRPC traffic. The Prometheus provider exports this metric as:
The Stackdriver provider exports this metric as:
|
REQUEST_SIZE | Histogram of request body sizes, generated for HTTP, HTTP/2, and GRPC traffic. The Prometheus provider exports this metric as: The Stackdriver provider exports this metric as:
|
RESPONSE_SIZE | Histogram of response body sizes, generated for HTTP, HTTP/2, and GRPC traffic. The Prometheus provider exports this metric as: The Stackdriver provider exports this metric as:
|
TCP_OPENED_CONNECTIONS | Counter of TCP connections opened over lifetime of workload. The Prometheus provider exports this metric as:
The Stackdriver provider exports this metric as:
|
TCP_CLOSED_CONNECTIONS | Counter of TCP connections closed over lifetime of workload. The Prometheus provider exports this metric as:
The Stackdriver provider exports this metric as:
|
TCP_SENT_BYTES | Counter of bytes sent during a response over a TCP connection. The Prometheus provider exports this metric as:
The Stackdriver provider exports this metric as:
|
TCP_RECEIVED_BYTES | Counter of bytes received during a request over a TCP connection. The Prometheus provider exports this metric as:
The Stackdriver provider exports this metric as:
|
GRPC_REQUEST_MESSAGES | Counter incremented for every gRPC messages sent from a client. The Prometheus provider exports this metric as:
|
GRPC_RESPONSE_MESSAGES | Counter incremented for every gRPC messages sent from a server. The Prometheus provider exports this metric as:
|
MetricsOverrides
MetricsOverrides defines custom metric generation behavior for an individual metric or the set of all standard metrics.
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.
Operation
Name | Description |
---|---|
UPSERT | Insert or Update the tag with the provided value expression. The
|
REMOVE | Specifies that the tag should not be included in the metric when generated. |
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.
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
.
Filter
Allows specification of an access log filter.
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).
Name | Description |
---|---|
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. |