Envoy Statistics
The Envoy proxy keeps detailed statistics about network traffic.
Envoy’s statistics only cover the traffic for a particular Envoy instance. See Observability for persistent per-service Istio telemetry. The statistics the Envoy proxies record can provide more information about specific pod instances.
To see the statistics for a pod:
$ kubectl exec "$POD" -c istio-proxy -- pilot-agent request GET stats
Envoy generates statistics about its behavior, scoping the statistics by proxy function. Examples include:
By default, Istio configures Envoy to record a minimal set of statistics to reduce the overall CPU and memory footprint of the installed proxies. The default collection keys are:
cluster_manager
listener_manager
server
cluster.xds-grpc
To see the Envoy settings for statistics data collection use istioctl proxy-config bootstrap and follow the deep dive into Envoy configuration. Envoy only collects statistical data on items matching the inclusion_list
within the stats_matcher
JSON element.
Note: The names of Envoy statistics can vary based on the composition of Envoy configuration. As a result, the exposed names of statistics for Envoys managed by Istio are subject to the configuration behavior of Istio. If you build or maintain dashboards or alerts based on Envoy statistics, it is strongly recommended that you examine the statistics in a canary environment before upgrading Istio.
To configure Istio proxy to record additional statistics, you can add ProxyConfig.ProxyStatsMatcher to your mesh config. For example, to enable stats for circuit breakers, request retries, upstream connections, and request timeouts globally, you can specify stats matcher as follows:
Proxy needs to restart to pick up the stats matcher configuration.
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
meshConfig:
defaultConfig:
proxyStatsMatcher:
inclusionRegexps:
- ".*outlier_detection.*"
- ".*upstream_rq_retry.*"
- ".*upstream_cx_.*"
inclusionSuffixes:
- "upstream_rq_timeout"
You can also override the global stats matching configuration per proxy by using the proxy.istio.io/config
annotation. For example, to configure the same stats generation inclusion as above, you can add the annotation to a gateway proxy or a workload as follows:
metadata:
annotations:
proxy.istio.io/config: |-
proxyStatsMatcher:
inclusionRegexps:
- ".*outlier_detection.*"
- ".*upstream_rq_retry.*"
- ".*upstream_cx_.*"
inclusionSuffixes:
- "upstream_rq_timeout"
Note: If you are using sidecar.istio.io/statsInclusionPrefixes
, sidecar.istio.io/statsInclusionRegexps
, and sidecar.istio.io/statsInclusionSuffixes
, consider switching to the ProxyConfig
-based configuration as it provides a global default and a uniform way to override at the gateway and sidecar proxy.