@@ -16,32 +16,50 @@ syntax = "proto3";
16
16
17
17
package istio.mixer.v1.config.descriptor ;
18
18
19
+ import "mixer/v1/config/descriptor/label_descriptor.proto" ;
20
+ import "mixer/v1/config/descriptor/value_type.proto" ;
21
+
19
22
// Defines a metric type and its schema.
20
23
//
21
- // A given metric is dimensioned by a set of attributes. A given metric holds a
22
- // unique value for potentially any combination of these attributes.
24
+ // A metric is dimensioned by a set of labels whose values are derived at runtime from attributes.
25
+ // A given metric holds a unique value for potentially any combination of these dimensions.
26
+ //
27
+ // The following is an example descriptor for a metric capturing the number of RPCs served, dimensioned
28
+ // by the method being called and response code returned by the server:
29
+ //
30
+ // metric_descriptor:
31
+ // name: "response_code"
32
+ // kind: COUNTER
33
+ // value: I64
34
+ // labels:
35
+ // name: api_method
36
+ // value_type: STRING
37
+ // labels:
38
+ // name: response_code
39
+ // value_type: INT64
40
+ //
41
+ // To actually report metrics at run time a mapping from attributes to a metric's labels must be provided.
42
+ // This is provided in the service's config; using our above descriptor we might describe the metric as:
43
+ //
44
+ // metric:
45
+ // descriptor: "response_code" # must match metric_descriptor.name
46
+ // value: $requestCount # Istio expression syntax for the attribute named "request_count"
47
+ // labels:
48
+ // # either the attribute named 'apiMethod' or the literal string 'unknown'; must eval to a string
49
+ // api_method: $apiMethod | "unknown"
50
+ // # either the attribute named 'responseCode' or the literal int64 500; must eval to an int64
51
+ // response_code: $responseCode | 500
52
+ //
23
53
message MetricDescriptor {
24
- // The name of this descriptor.
54
+ // The name of this descriptor. This is used to refer to this descriptor in other contexts.
25
55
string name = 1 ;
26
56
27
- // The name of the attribute that supplies the value for metrics
28
- // of this type.
29
- string value_attribute = 2 ;
30
-
31
- // The set of attributes that are necessary to describe a specific value cell
32
- // for a metric of this type.
33
- repeated string attributes = 3 ;
34
-
35
- // Whether the metric records instantaneous values, changes to a value, etc.
36
- MetricKind metric_kind = 4 ;
37
-
38
- // An optional description of the metric, which should be used as the
39
- // documentation of the metric.
40
- string description = 5 ;
41
-
42
57
// An optional concise name for the metric, which can be displayed in user interfaces.
43
58
// Use sentence case without an ending period, for example "Request count".
44
- string display_name = 6 ;
59
+ string display_name = 2 ;
60
+
61
+ // An optional description of the metric, which should be used as the documentation for the metric.
62
+ string description = 3 ;
45
63
46
64
// The kind of measurement. It describes how the data is recorded.
47
65
enum MetricKind {
@@ -55,4 +73,14 @@ message MetricDescriptor {
55
73
// For example, the number of API requests.
56
74
COUNTER = 2 ;
57
75
}
76
+ // Whether the metric records instantaneous values, changes to a value, etc.
77
+ MetricKind kind = 4 ;
78
+
79
+ // The type of data this metric records.
80
+ ValueType value = 5 ;
81
+
82
+ // Labels that dimension the data recorded by this metric. The metric definition allows the user to
83
+ // map attribute expressions to actual values for these labels at run time; the result of the evaluation
84
+ // must be of the type described by the kind for each label.
85
+ repeated LabelDescriptor labels = 6 ;
58
86
}
0 commit comments