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