metrics

MetricsParams

Configures a metric aspect.

FieldTypeDescription
metrics[]repeated MetricThe set of metrics that will be populated and handed to aspects at run time.

Metric

Describes how attributes must be evaluated to produce values for the named metric. Suppose the following MetricDescriptor exists in the global configuration:

metricDescriptor:
  name: "responseCode"
  kind: COUNTER
  value: I64
  labels:
    name: apiMethod
    valueType: STRING
  labels:
    name: responseCode
    valueType: I64

To actually report metrics at run time a mapping from attributes to a metric’s labels must be provided in the form of a metric:

metric:
  descriptorName: "responseCode" # must match metricDescriptor.name
  value: $requestCount        # Istio expression syntax for the attribute named "requestCount"
  labels:
    # either the attribute named 'apiMethod' or the literal string 'unknown'; must eval to a string
    apiMethod: $apiMethod | "unknown"
    # either the attribute named 'responseCode' or the literal int64 500; must eval to an int64
    responseCode: $responseCode | 500
FieldTypeDescription
descriptorNamestringMust match the name of some metricDescriptor in the global config.
valuestringAttribute expression to evaluate to determine the value for this metric; the result of the evaluation must match the value ValueType of the metricDescriptor.
labelsrepeated map<string, string>Map of metricDescriptor label name to attribute expression. At run time each expression will be evaluated to determine the value provided to the aspect. The result of evaluating the expression must match the ValueType of the label in the metricDescriptor.