Configurable V2 Metrics
Istio 1.5 includes an experimental support for modifying the standard metrics.
The API to configure the metrics is certain to change in Istio 1.6 as part of the extensions API design.
To enable this feature, two steps must be performed:
-
Configure
EnvoyFilter
to add, remove, or edit the dimensions and the metrics produced by Istio stats extension. -
Annotate pods to extract the extra dimensions to the prometheus stats.
Locate the envoy.wasm.stats
extension configuration. The default configuration is in the configuration
section and typically looks like this:
{
"debug": "false",
"stat_prefix": "istio"
}
Augment the configuration section for each instance of the extension configuration. For example, to add destination_port
and request_host
dimensions to the standard requests_total
metric, change it to look like this:
{
"debug": "false",
"stat_prefix": "istio",
"metrics": [
{
"name": "requests_total",
"dimensions": {
"destination_port": "destination.port",
"request_host": "request.host"
}
}
]
}
Note that all the metric names are automatically prefixed with istio_
, so you need to omit the prefix from the name field in the metric specification.
The configuration consists of two parts: definitions and metrics. The definition section supports creating entirely new metrics by name, the expected value expression, and the metric type (counter, gauge, histogram). The metric section provides values for the dimensions of the metric as expressions, and also allows removing or overriding the existing metric dimensions.
By default, Istio defines a set of the standard metrics (e.g. requests_total
). The configuration is resolved relative to the standard metrics, e.g. with no configuration the standard metrics are emitted. However, using tags_to_remove
or by re-defining a dimension, the standard metrics can be modified.
See the reference specification.
The values in the metric configuration are common expressions. That means, for example, that strings must be double-quoted in JSON, e.g. "'some_string_value'"
. Unlike Mixer expression language, there is no support for the pipe (|
) operator at the moment, but it can be emulated with either has
or in
: has(request.host) ? request.host : "unknown"
.
All the standard Envoy attributes are exposed. Additionally, a few extra attributes can be used:
Attribute | Type | Value |
---|---|---|
listener_direction |
int64 | Enum value for listener direction |
listener_metadata |
metadata | Per-listener metadata |
route_metadata |
metadata | Per-route metadata |
cluster_metadata |
metadata | Per-cluster metadata |
node |
node | Node description |
cluster_name |
string | Upstream cluster name |
route_name |
string | Route name |
filter_state ** (1.5 only) |
map<string, bytes> | Per-filter state blob, any name not covered elsewhere is searched in the filter_state starting 1.6. So specifying filter_state['key'] is not supported. |
plugin_name |
string | Wasm extension name |
plugin_root_id |
string | Wasm root instance ID |
plugin_vm_id |
string | Wasm VM ID |
Each injected pod should have an annotation with the list of the dimensions to be extracted into Prometheus time series. The following annotation should be applied to all injected pods for the example above:
apiVersion: extensions/v1beta1
kind: Deployment
spec:
template:
metadata:
annotations:
sidecar.istio.io/extraStatTags: destination_port,request_host
Visit istio.io to learn how to use Istio.
- Preparing for Development Mac
- Preparing for Development Linux
- Troubleshooting Development Environment
- Repository Map
- GitHub Workflow
- Github Gmail Filters
- Using the Code Base
- Developing with Minikube
- Remote Debugging
- Verify your Docker Environment
- Istio Test Framework
- Working with Prow
- Test Grid
- Code Coverage FAQ
- Writing Good Integration Tests
- Test Flakes
- Release Manager Expectations
- Preparing Istio Releases
- 1.5 Release Information
- 1.6 Release Information
- 1.7 Release Information
- 1.8 Release Information
- 1.9 Release Information
- 1.10 Release Information
- 1.11 Release Information
- 1.12 Release Information
- 1.13 Release Information
- 1.14 Release Information
- 1.15 Release Information
- 1.16 Release Information
- 1.17 Release Information
- 1.18 Release Information
- 1.19 Release Information
- 1.20 Release Information
- 1.21 Release Information
- 1.22 Release Information
- Collecting Logs and Debug Info
- Dependency FAQ
- Working with discuss.istio.io
- Developing with and hosting upon OpenShift
- Adapter Dev Guide
- Adapter Walkthrough
- Attribute Generating Adapter Walkthrough
- Route Directive Adapter Development Guide
- Out of Tree Adapter Walkthrough
- Running a Local Instance
- Template Dev Guide
- Using a Custom Adapter
- Publishing Adapters and Templates to istio.io
- Enabling Envoy Authorization Service and gRPC Access Log Service With Mixer