metric template is designed to let you describe runtime metric to dispatch to monitoring backends.
apiVersion: "config.istio.io/v1alpha2" kind: metric metadata: name: requestsize namespace: istio-system spec: value: request.size | 0 dimensions: source_service: source.service | "unknown" source_version: source.labels["version"] | "unknown" destination_service: destination.service | "unknown" destination_version: destination.labels["version"] | "unknown" response_code: response.code | 200 monitored_resource_type: '"UNSPECIFIED"'
metric template represents a single piece of data to report.
When writing the configuration, the value for the fields associated with this template can either be a literal or an expression. Please note that if the datatype of a field is not istio.policy.v1beta1.Value, then the expression’s inferred type must match the datatype of the field.
An instance field of type Value denotes that the expression for the field is of dynamic type and can evalaute to any ValueType enum values. For example, when authoring an instance configuration for a template that has a field
data of type
istio.policy.v1beta1.Value, both of the following expressions are valid
data: source.ip | ip("0.0.0.0"),
data: request.id | ""; the resulting type is either ValueType.IP_ADDRESS or ValueType.STRING for the two cases respectively.
Objects of type Value are also passed to the adapters during request-time. There is a 1:1 mapping between oneof fields in
Value and enum values inside
ValueType. Depending on the expression’s evaluated
ValueType, the equivalent oneof field in
Value is populated by Mixer and passed to the adapters.