xref: /aosp_15_r20/external/googleapis/google/monitoring/v3/metric.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.monitoring.v3;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/api/label.proto";
20*d5c09012SAndroid Build Coastguard Workerimport "google/api/metric.proto";
21*d5c09012SAndroid Build Coastguard Workerimport "google/api/monitored_resource.proto";
22*d5c09012SAndroid Build Coastguard Workerimport "google/monitoring/v3/common.proto";
23*d5c09012SAndroid Build Coastguard Worker
24*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Cloud.Monitoring.V3";
25*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpb";
26*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
27*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "MetricProto";
28*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.monitoring.v3";
29*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\Monitoring\\V3";
30*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::Monitoring::V3";
31*d5c09012SAndroid Build Coastguard Worker
32*d5c09012SAndroid Build Coastguard Worker// A single data point in a time series.
33*d5c09012SAndroid Build Coastguard Workermessage Point {
34*d5c09012SAndroid Build Coastguard Worker  // The time interval to which the data point applies.  For `GAUGE` metrics,
35*d5c09012SAndroid Build Coastguard Worker  // the start time is optional, but if it is supplied, it must equal the
36*d5c09012SAndroid Build Coastguard Worker  // end time.  For `DELTA` metrics, the start
37*d5c09012SAndroid Build Coastguard Worker  // and end time should specify a non-zero interval, with subsequent points
38*d5c09012SAndroid Build Coastguard Worker  // specifying contiguous and non-overlapping intervals.  For `CUMULATIVE`
39*d5c09012SAndroid Build Coastguard Worker  // metrics, the start and end time should specify a non-zero interval, with
40*d5c09012SAndroid Build Coastguard Worker  // subsequent points specifying the same start time and increasing end times,
41*d5c09012SAndroid Build Coastguard Worker  // until an event resets the cumulative value to zero and sets a new start
42*d5c09012SAndroid Build Coastguard Worker  // time for the following points.
43*d5c09012SAndroid Build Coastguard Worker  TimeInterval interval = 1;
44*d5c09012SAndroid Build Coastguard Worker
45*d5c09012SAndroid Build Coastguard Worker  // The value of the data point.
46*d5c09012SAndroid Build Coastguard Worker  TypedValue value = 2;
47*d5c09012SAndroid Build Coastguard Worker}
48*d5c09012SAndroid Build Coastguard Worker
49*d5c09012SAndroid Build Coastguard Worker// A collection of data points that describes the time-varying values
50*d5c09012SAndroid Build Coastguard Worker// of a metric. A time series is identified by a combination of a
51*d5c09012SAndroid Build Coastguard Worker// fully-specified monitored resource and a fully-specified metric.
52*d5c09012SAndroid Build Coastguard Worker// This type is used for both listing and creating time series.
53*d5c09012SAndroid Build Coastguard Workermessage TimeSeries {
54*d5c09012SAndroid Build Coastguard Worker  // The associated metric. A fully-specified metric used to identify the time
55*d5c09012SAndroid Build Coastguard Worker  // series.
56*d5c09012SAndroid Build Coastguard Worker  google.api.Metric metric = 1;
57*d5c09012SAndroid Build Coastguard Worker
58*d5c09012SAndroid Build Coastguard Worker  // The associated monitored resource.  Custom metrics can use only certain
59*d5c09012SAndroid Build Coastguard Worker  // monitored resource types in their time series data. For more information,
60*d5c09012SAndroid Build Coastguard Worker  // see [Monitored resources for custom
61*d5c09012SAndroid Build Coastguard Worker  // metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources).
62*d5c09012SAndroid Build Coastguard Worker  google.api.MonitoredResource resource = 2;
63*d5c09012SAndroid Build Coastguard Worker
64*d5c09012SAndroid Build Coastguard Worker  // Output only. The associated monitored resource metadata. When reading a
65*d5c09012SAndroid Build Coastguard Worker  // time series, this field will include metadata labels that are explicitly
66*d5c09012SAndroid Build Coastguard Worker  // named in the reduction. When creating a time series, this field is ignored.
67*d5c09012SAndroid Build Coastguard Worker  google.api.MonitoredResourceMetadata metadata = 7;
68*d5c09012SAndroid Build Coastguard Worker
69*d5c09012SAndroid Build Coastguard Worker  // The metric kind of the time series. When listing time series, this metric
70*d5c09012SAndroid Build Coastguard Worker  // kind might be different from the metric kind of the associated metric if
71*d5c09012SAndroid Build Coastguard Worker  // this time series is an alignment or reduction of other time series.
72*d5c09012SAndroid Build Coastguard Worker  //
73*d5c09012SAndroid Build Coastguard Worker  // When creating a time series, this field is optional. If present, it must be
74*d5c09012SAndroid Build Coastguard Worker  // the same as the metric kind of the associated metric. If the associated
75*d5c09012SAndroid Build Coastguard Worker  // metric's descriptor must be auto-created, then this field specifies the
76*d5c09012SAndroid Build Coastguard Worker  // metric kind of the new descriptor and must be either `GAUGE` (the default)
77*d5c09012SAndroid Build Coastguard Worker  // or `CUMULATIVE`.
78*d5c09012SAndroid Build Coastguard Worker  google.api.MetricDescriptor.MetricKind metric_kind = 3;
79*d5c09012SAndroid Build Coastguard Worker
80*d5c09012SAndroid Build Coastguard Worker  // The value type of the time series. When listing time series, this value
81*d5c09012SAndroid Build Coastguard Worker  // type might be different from the value type of the associated metric if
82*d5c09012SAndroid Build Coastguard Worker  // this time series is an alignment or reduction of other time series.
83*d5c09012SAndroid Build Coastguard Worker  //
84*d5c09012SAndroid Build Coastguard Worker  // When creating a time series, this field is optional. If present, it must be
85*d5c09012SAndroid Build Coastguard Worker  // the same as the type of the data in the `points` field.
86*d5c09012SAndroid Build Coastguard Worker  google.api.MetricDescriptor.ValueType value_type = 4;
87*d5c09012SAndroid Build Coastguard Worker
88*d5c09012SAndroid Build Coastguard Worker  // The data points of this time series. When listing time series, points are
89*d5c09012SAndroid Build Coastguard Worker  // returned in reverse time order.
90*d5c09012SAndroid Build Coastguard Worker  //
91*d5c09012SAndroid Build Coastguard Worker  // When creating a time series, this field must contain exactly one point and
92*d5c09012SAndroid Build Coastguard Worker  // the point's type must be the same as the value type of the associated
93*d5c09012SAndroid Build Coastguard Worker  // metric. If the associated metric's descriptor must be auto-created, then
94*d5c09012SAndroid Build Coastguard Worker  // the value type of the descriptor is determined by the point's type, which
95*d5c09012SAndroid Build Coastguard Worker  // must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
96*d5c09012SAndroid Build Coastguard Worker  repeated Point points = 5;
97*d5c09012SAndroid Build Coastguard Worker
98*d5c09012SAndroid Build Coastguard Worker  // The units in which the metric value is reported. It is only applicable
99*d5c09012SAndroid Build Coastguard Worker  // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit`
100*d5c09012SAndroid Build Coastguard Worker  // defines the representation of the stored metric values.
101*d5c09012SAndroid Build Coastguard Worker  string unit = 8;
102*d5c09012SAndroid Build Coastguard Worker}
103*d5c09012SAndroid Build Coastguard Worker
104*d5c09012SAndroid Build Coastguard Worker// A descriptor for the labels and points in a time series.
105*d5c09012SAndroid Build Coastguard Workermessage TimeSeriesDescriptor {
106*d5c09012SAndroid Build Coastguard Worker  // A descriptor for the value columns in a data point.
107*d5c09012SAndroid Build Coastguard Worker  message ValueDescriptor {
108*d5c09012SAndroid Build Coastguard Worker    // The value key.
109*d5c09012SAndroid Build Coastguard Worker    string key = 1;
110*d5c09012SAndroid Build Coastguard Worker
111*d5c09012SAndroid Build Coastguard Worker    // The value type.
112*d5c09012SAndroid Build Coastguard Worker    google.api.MetricDescriptor.ValueType value_type = 2;
113*d5c09012SAndroid Build Coastguard Worker
114*d5c09012SAndroid Build Coastguard Worker    // The value stream kind.
115*d5c09012SAndroid Build Coastguard Worker    google.api.MetricDescriptor.MetricKind metric_kind = 3;
116*d5c09012SAndroid Build Coastguard Worker
117*d5c09012SAndroid Build Coastguard Worker    // The unit in which `time_series` point values are reported. `unit`
118*d5c09012SAndroid Build Coastguard Worker    // follows the UCUM format for units as seen in
119*d5c09012SAndroid Build Coastguard Worker    // https://unitsofmeasure.org/ucum.html.
120*d5c09012SAndroid Build Coastguard Worker    // `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION.
121*d5c09012SAndroid Build Coastguard Worker    string unit = 4;
122*d5c09012SAndroid Build Coastguard Worker  }
123*d5c09012SAndroid Build Coastguard Worker
124*d5c09012SAndroid Build Coastguard Worker  // Descriptors for the labels.
125*d5c09012SAndroid Build Coastguard Worker  repeated google.api.LabelDescriptor label_descriptors = 1;
126*d5c09012SAndroid Build Coastguard Worker
127*d5c09012SAndroid Build Coastguard Worker  // Descriptors for the point data value columns.
128*d5c09012SAndroid Build Coastguard Worker  repeated ValueDescriptor point_descriptors = 5;
129*d5c09012SAndroid Build Coastguard Worker}
130*d5c09012SAndroid Build Coastguard Worker
131*d5c09012SAndroid Build Coastguard Worker// Represents the values of a time series associated with a
132*d5c09012SAndroid Build Coastguard Worker// TimeSeriesDescriptor.
133*d5c09012SAndroid Build Coastguard Workermessage TimeSeriesData {
134*d5c09012SAndroid Build Coastguard Worker  // A point's value columns and time interval. Each point has one or more
135*d5c09012SAndroid Build Coastguard Worker  // point values corresponding to the entries in `point_descriptors` field in
136*d5c09012SAndroid Build Coastguard Worker  // the TimeSeriesDescriptor associated with this object.
137*d5c09012SAndroid Build Coastguard Worker  message PointData {
138*d5c09012SAndroid Build Coastguard Worker    // The values that make up the point.
139*d5c09012SAndroid Build Coastguard Worker    repeated TypedValue values = 1;
140*d5c09012SAndroid Build Coastguard Worker
141*d5c09012SAndroid Build Coastguard Worker    // The time interval associated with the point.
142*d5c09012SAndroid Build Coastguard Worker    TimeInterval time_interval = 2;
143*d5c09012SAndroid Build Coastguard Worker  }
144*d5c09012SAndroid Build Coastguard Worker
145*d5c09012SAndroid Build Coastguard Worker  // The values of the labels in the time series identifier, given in the same
146*d5c09012SAndroid Build Coastguard Worker  // order as the `label_descriptors` field of the TimeSeriesDescriptor
147*d5c09012SAndroid Build Coastguard Worker  // associated with this object. Each value must have a value of the type
148*d5c09012SAndroid Build Coastguard Worker  // given in the corresponding entry of `label_descriptors`.
149*d5c09012SAndroid Build Coastguard Worker  repeated LabelValue label_values = 1;
150*d5c09012SAndroid Build Coastguard Worker
151*d5c09012SAndroid Build Coastguard Worker  // The points in the time series.
152*d5c09012SAndroid Build Coastguard Worker  repeated PointData point_data = 2;
153*d5c09012SAndroid Build Coastguard Worker}
154*d5c09012SAndroid Build Coastguard Worker
155*d5c09012SAndroid Build Coastguard Worker// A label value.
156*d5c09012SAndroid Build Coastguard Workermessage LabelValue {
157*d5c09012SAndroid Build Coastguard Worker  // The label value can be a bool, int64, or string.
158*d5c09012SAndroid Build Coastguard Worker  oneof value {
159*d5c09012SAndroid Build Coastguard Worker    // A bool label value.
160*d5c09012SAndroid Build Coastguard Worker    bool bool_value = 1;
161*d5c09012SAndroid Build Coastguard Worker
162*d5c09012SAndroid Build Coastguard Worker    // An int64 label value.
163*d5c09012SAndroid Build Coastguard Worker    int64 int64_value = 2;
164*d5c09012SAndroid Build Coastguard Worker
165*d5c09012SAndroid Build Coastguard Worker    // A string label value.
166*d5c09012SAndroid Build Coastguard Worker    string string_value = 3;
167*d5c09012SAndroid Build Coastguard Worker  }
168*d5c09012SAndroid Build Coastguard Worker}
169*d5c09012SAndroid Build Coastguard Worker
170*d5c09012SAndroid Build Coastguard Worker// An error associated with a query in the time series query language format.
171*d5c09012SAndroid Build Coastguard Workermessage QueryError {
172*d5c09012SAndroid Build Coastguard Worker  // The location of the time series query language text that this error applies
173*d5c09012SAndroid Build Coastguard Worker  // to.
174*d5c09012SAndroid Build Coastguard Worker  TextLocator locator = 1;
175*d5c09012SAndroid Build Coastguard Worker
176*d5c09012SAndroid Build Coastguard Worker  // The error message.
177*d5c09012SAndroid Build Coastguard Worker  string message = 2;
178*d5c09012SAndroid Build Coastguard Worker}
179*d5c09012SAndroid Build Coastguard Worker
180*d5c09012SAndroid Build Coastguard Worker// A locator for text. Indicates a particular part of the text of a request or
181*d5c09012SAndroid Build Coastguard Worker// of an object referenced in the request.
182*d5c09012SAndroid Build Coastguard Worker//
183*d5c09012SAndroid Build Coastguard Worker// For example, suppose the request field `text` contains:
184*d5c09012SAndroid Build Coastguard Worker//
185*d5c09012SAndroid Build Coastguard Worker//   text: "The quick brown fox jumps over the lazy dog."
186*d5c09012SAndroid Build Coastguard Worker//
187*d5c09012SAndroid Build Coastguard Worker// Then the locator:
188*d5c09012SAndroid Build Coastguard Worker//
189*d5c09012SAndroid Build Coastguard Worker//   source: "text"
190*d5c09012SAndroid Build Coastguard Worker//   start_position {
191*d5c09012SAndroid Build Coastguard Worker//     line: 1
192*d5c09012SAndroid Build Coastguard Worker//     column: 17
193*d5c09012SAndroid Build Coastguard Worker//   }
194*d5c09012SAndroid Build Coastguard Worker//   end_position {
195*d5c09012SAndroid Build Coastguard Worker//     line: 1
196*d5c09012SAndroid Build Coastguard Worker//     column: 19
197*d5c09012SAndroid Build Coastguard Worker//   }
198*d5c09012SAndroid Build Coastguard Worker//
199*d5c09012SAndroid Build Coastguard Worker// refers to the part of the text: "fox".
200*d5c09012SAndroid Build Coastguard Workermessage TextLocator {
201*d5c09012SAndroid Build Coastguard Worker  // The position of a byte within the text.
202*d5c09012SAndroid Build Coastguard Worker  message Position {
203*d5c09012SAndroid Build Coastguard Worker    // The line, starting with 1, where the byte is positioned.
204*d5c09012SAndroid Build Coastguard Worker    int32 line = 1;
205*d5c09012SAndroid Build Coastguard Worker
206*d5c09012SAndroid Build Coastguard Worker    // The column within the line, starting with 1, where the byte is
207*d5c09012SAndroid Build Coastguard Worker    // positioned. This is a byte index even though the text is UTF-8.
208*d5c09012SAndroid Build Coastguard Worker    int32 column = 2;
209*d5c09012SAndroid Build Coastguard Worker  }
210*d5c09012SAndroid Build Coastguard Worker
211*d5c09012SAndroid Build Coastguard Worker  // The source of the text. The source may be a field in the request, in which
212*d5c09012SAndroid Build Coastguard Worker  // case its format is the format of the
213*d5c09012SAndroid Build Coastguard Worker  // google.rpc.BadRequest.FieldViolation.field field in
214*d5c09012SAndroid Build Coastguard Worker  // https://cloud.google.com/apis/design/errors#error_details. It may also be
215*d5c09012SAndroid Build Coastguard Worker  // be a source other than the request field (e.g. a macro definition
216*d5c09012SAndroid Build Coastguard Worker  // referenced in the text of the query), in which case this is the name of
217*d5c09012SAndroid Build Coastguard Worker  // the source (e.g. the macro name).
218*d5c09012SAndroid Build Coastguard Worker  string source = 1;
219*d5c09012SAndroid Build Coastguard Worker
220*d5c09012SAndroid Build Coastguard Worker  // The position of the first byte within the text.
221*d5c09012SAndroid Build Coastguard Worker  Position start_position = 2;
222*d5c09012SAndroid Build Coastguard Worker
223*d5c09012SAndroid Build Coastguard Worker  // The position of the last byte within the text.
224*d5c09012SAndroid Build Coastguard Worker  Position end_position = 3;
225*d5c09012SAndroid Build Coastguard Worker
226*d5c09012SAndroid Build Coastguard Worker  // If `source`, `start_position`, and `end_position` describe a call on
227*d5c09012SAndroid Build Coastguard Worker  // some object (e.g. a macro in the time series query language text) and a
228*d5c09012SAndroid Build Coastguard Worker  // location is to be designated in that object's text, `nested_locator`
229*d5c09012SAndroid Build Coastguard Worker  // identifies the location within that object.
230*d5c09012SAndroid Build Coastguard Worker  TextLocator nested_locator = 4;
231*d5c09012SAndroid Build Coastguard Worker
232*d5c09012SAndroid Build Coastguard Worker  // When `nested_locator` is set, this field gives the reason for the nesting.
233*d5c09012SAndroid Build Coastguard Worker  // Usually, the reason is a macro invocation. In that case, the macro name
234*d5c09012SAndroid Build Coastguard Worker  // (including the leading '@') signals the location of the macro call
235*d5c09012SAndroid Build Coastguard Worker  // in the text and a macro argument name (including the leading '$') signals
236*d5c09012SAndroid Build Coastguard Worker  // the location of the macro argument inside the macro body that got
237*d5c09012SAndroid Build Coastguard Worker  // substituted away.
238*d5c09012SAndroid Build Coastguard Worker  string nesting_reason = 5;
239*d5c09012SAndroid Build Coastguard Worker}
240