--- WARNING: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT. PLEASE MODIFY THE ORIGINAL SOURCE IN THE 'https://github.com/istio/istio' REPO source_repo: https://github.com/istio/istio title: Metric description: A template that represents a single runtime metric. location: https://istio.io/docs/reference/config/policy-and-telemetry/templates/metric.html layout: protoc-gen-docs generator: protoc-gen-docs aliases: - /docs/reference/config/template/metric.html number_of_entries: 1 ---

The `metric` template is designed to let you describe runtime metric to dispatch to monitoring backends.

Example config:

    apiVersion: "config.istio.io/v1alpha2"
    kind: instance
    metadata:
      name: requestsize
      namespace: istio-system
    spec:
      compiledTemplate: metric
      params:
        value: request.size | 0
        dimensions:
          source_version: source.labels["version"] | "unknown"
          destination_service: destination.service.host | "unknown"
          destination_version: destination.labels["version"] | "unknown"
          response_code: response.code | 200
        monitored_resource_type: '"UNSPECIFIED"'

## Template

The `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.

Field | Type | Description | Required
--- | --- | --- | ---
`value` | `Value` | The value being reported. | No
`dimensions` | `map<string, Value>` | The unique identity of the particular metric to report. | No
`monitoredResourceType` | `string` | Optional. An expression to compute the type of the monitored resource this metric is being reported on. If the metric backend supports monitored resources, these fields are used to populate that resource. Otherwise these fields will be ignored by the adapter. | No
`monitoredResourceDimensions` | `map<string, Value>` | Optional. A set of expressions that will form the dimensions of the monitored resource this metric is being reported on. If the metric backend supports monitored resources, these fields are used to populate that resource. Otherwise these fields will be ignored by the adapter. | No