metric_service.proto 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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. syntax = "proto3";
  15. package google.monitoring.v3;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/metric.proto";
  20. import "google/api/monitored_resource.proto";
  21. import "google/api/resource.proto";
  22. import "google/monitoring/v3/alert.proto";
  23. import "google/monitoring/v3/common.proto";
  24. import "google/monitoring/v3/metric.proto";
  25. import "google/protobuf/duration.proto";
  26. import "google/protobuf/empty.proto";
  27. import "google/rpc/status.proto";
  28. option csharp_namespace = "Google.Cloud.Monitoring.V3";
  29. option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring";
  30. option java_multiple_files = true;
  31. option java_outer_classname = "MetricServiceProto";
  32. option java_package = "com.google.monitoring.v3";
  33. option php_namespace = "Google\\Cloud\\Monitoring\\V3";
  34. option ruby_package = "Google::Cloud::Monitoring::V3";
  35. option (google.api.resource_definition) = {
  36. type: "monitoring.googleapis.com/MetricDescriptor"
  37. pattern: "projects/{project}/metricDescriptors/{metric_descriptor=**}"
  38. pattern: "organizations/{organization}/metricDescriptors/{metric_descriptor=**}"
  39. pattern: "folders/{folder}/metricDescriptors/{metric_descriptor=**}"
  40. pattern: "*"
  41. history: ORIGINALLY_SINGLE_PATTERN
  42. };
  43. option (google.api.resource_definition) = {
  44. type: "monitoring.googleapis.com/MonitoredResourceDescriptor"
  45. pattern: "projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
  46. pattern: "organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
  47. pattern: "folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
  48. pattern: "*"
  49. history: ORIGINALLY_SINGLE_PATTERN
  50. };
  51. option (google.api.resource_definition) = {
  52. type: "monitoring.googleapis.com/Workspace"
  53. pattern: "projects/{project}"
  54. pattern: "workspaces/{workspace}"
  55. };
  56. option (google.api.resource_definition) = {
  57. type: "monitoring.googleapis.com/TimeSeries"
  58. pattern: "projects/{project}/timeSeries/{time_series}"
  59. pattern: "organizations/{organization}/timeSeries/{time_series}"
  60. pattern: "folders/{folder}/timeSeries/{time_series}"
  61. };
  62. // Manages metric descriptors, monitored resource descriptors, and
  63. // time series data.
  64. service MetricService {
  65. option (google.api.default_host) = "monitoring.googleapis.com";
  66. option (google.api.oauth_scopes) =
  67. "https://www.googleapis.com/auth/cloud-platform,"
  68. "https://www.googleapis.com/auth/monitoring,"
  69. "https://www.googleapis.com/auth/monitoring.read,"
  70. "https://www.googleapis.com/auth/monitoring.write";
  71. // Lists monitored resource descriptors that match a filter. This method does not require a Workspace.
  72. rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) {
  73. option (google.api.http) = {
  74. get: "/v3/{name=projects/*}/monitoredResourceDescriptors"
  75. };
  76. option (google.api.method_signature) = "name";
  77. }
  78. // Gets a single monitored resource descriptor. This method does not require a Workspace.
  79. rpc GetMonitoredResourceDescriptor(GetMonitoredResourceDescriptorRequest) returns (google.api.MonitoredResourceDescriptor) {
  80. option (google.api.http) = {
  81. get: "/v3/{name=projects/*/monitoredResourceDescriptors/**}"
  82. };
  83. option (google.api.method_signature) = "name";
  84. }
  85. // Lists metric descriptors that match a filter. This method does not require a Workspace.
  86. rpc ListMetricDescriptors(ListMetricDescriptorsRequest) returns (ListMetricDescriptorsResponse) {
  87. option (google.api.http) = {
  88. get: "/v3/{name=projects/*}/metricDescriptors"
  89. };
  90. option (google.api.method_signature) = "name";
  91. }
  92. // Gets a single metric descriptor. This method does not require a Workspace.
  93. rpc GetMetricDescriptor(GetMetricDescriptorRequest) returns (google.api.MetricDescriptor) {
  94. option (google.api.http) = {
  95. get: "/v3/{name=projects/*/metricDescriptors/**}"
  96. };
  97. option (google.api.method_signature) = "name";
  98. }
  99. // Creates a new metric descriptor.
  100. // User-created metric descriptors define
  101. // [custom metrics](https://cloud.google.com/monitoring/custom-metrics).
  102. rpc CreateMetricDescriptor(CreateMetricDescriptorRequest) returns (google.api.MetricDescriptor) {
  103. option (google.api.http) = {
  104. post: "/v3/{name=projects/*}/metricDescriptors"
  105. body: "metric_descriptor"
  106. };
  107. option (google.api.method_signature) = "name,metric_descriptor";
  108. }
  109. // Deletes a metric descriptor. Only user-created
  110. // [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be
  111. // deleted.
  112. rpc DeleteMetricDescriptor(DeleteMetricDescriptorRequest) returns (google.protobuf.Empty) {
  113. option (google.api.http) = {
  114. delete: "/v3/{name=projects/*/metricDescriptors/**}"
  115. };
  116. option (google.api.method_signature) = "name";
  117. }
  118. // Lists time series that match a filter. This method does not require a Workspace.
  119. rpc ListTimeSeries(ListTimeSeriesRequest) returns (ListTimeSeriesResponse) {
  120. option (google.api.http) = {
  121. get: "/v3/{name=projects/*}/timeSeries"
  122. additional_bindings {
  123. get: "/v3/{name=organizations/*}/timeSeries"
  124. }
  125. additional_bindings {
  126. get: "/v3/{name=folders/*}/timeSeries"
  127. }
  128. };
  129. option (google.api.method_signature) = "name,filter,interval,view";
  130. }
  131. // Creates or adds data to one or more time series.
  132. // The response is empty if all time series in the request were written.
  133. // If any time series could not be written, a corresponding failure message is
  134. // included in the error response.
  135. rpc CreateTimeSeries(CreateTimeSeriesRequest) returns (google.protobuf.Empty) {
  136. option (google.api.http) = {
  137. post: "/v3/{name=projects/*}/timeSeries"
  138. body: "*"
  139. };
  140. option (google.api.method_signature) = "name,time_series";
  141. }
  142. }
  143. // The `ListMonitoredResourceDescriptors` request.
  144. message ListMonitoredResourceDescriptorsRequest {
  145. // Required. The project on which to execute the request. The format is:
  146. //
  147. // projects/[PROJECT_ID_OR_NUMBER]
  148. string name = 5 [
  149. (google.api.field_behavior) = REQUIRED,
  150. (google.api.resource_reference) = {
  151. child_type: "monitoring.googleapis.com/MonitoredResourceDescriptor"
  152. }
  153. ];
  154. // An optional [filter](https://cloud.google.com/monitoring/api/v3/filters)
  155. // describing the descriptors to be returned. The filter can reference the
  156. // descriptor's type and labels. For example, the following filter returns
  157. // only Google Compute Engine descriptors that have an `id` label:
  158. //
  159. // resource.type = starts_with("gce_") AND resource.label:id
  160. string filter = 2;
  161. // A positive number that is the maximum number of results to return.
  162. int32 page_size = 3;
  163. // If this field is not empty then it must contain the `nextPageToken` value
  164. // returned by a previous call to this method. Using this field causes the
  165. // method to return additional results from the previous method call.
  166. string page_token = 4;
  167. }
  168. // The `ListMonitoredResourceDescriptors` response.
  169. message ListMonitoredResourceDescriptorsResponse {
  170. // The monitored resource descriptors that are available to this project
  171. // and that match `filter`, if present.
  172. repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1;
  173. // If there are more results than have been returned, then this field is set
  174. // to a non-empty value. To see the additional results,
  175. // use that value as `page_token` in the next call to this method.
  176. string next_page_token = 2;
  177. }
  178. // The `GetMonitoredResourceDescriptor` request.
  179. message GetMonitoredResourceDescriptorRequest {
  180. // Required. The monitored resource descriptor to get. The format is:
  181. //
  182. // projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE]
  183. //
  184. // The `[RESOURCE_TYPE]` is a predefined type, such as
  185. // `cloudsql_database`.
  186. string name = 3 [
  187. (google.api.field_behavior) = REQUIRED,
  188. (google.api.resource_reference) = {
  189. type: "monitoring.googleapis.com/MonitoredResourceDescriptor"
  190. }
  191. ];
  192. }
  193. // The `ListMetricDescriptors` request.
  194. message ListMetricDescriptorsRequest {
  195. // Required. The project on which to execute the request. The format is:
  196. //
  197. // projects/[PROJECT_ID_OR_NUMBER]
  198. string name = 5 [
  199. (google.api.field_behavior) = REQUIRED,
  200. (google.api.resource_reference) = {
  201. child_type: "monitoring.googleapis.com/MetricDescriptor"
  202. }
  203. ];
  204. // If this field is empty, all custom and
  205. // system-defined metric descriptors are returned.
  206. // Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters)
  207. // specifies which metric descriptors are to be
  208. // returned. For example, the following filter matches all
  209. // [custom metrics](https://cloud.google.com/monitoring/custom-metrics):
  210. //
  211. // metric.type = starts_with("custom.googleapis.com/")
  212. string filter = 2;
  213. // A positive number that is the maximum number of results to return.
  214. int32 page_size = 3;
  215. // If this field is not empty then it must contain the `nextPageToken` value
  216. // returned by a previous call to this method. Using this field causes the
  217. // method to return additional results from the previous method call.
  218. string page_token = 4;
  219. }
  220. // The `ListMetricDescriptors` response.
  221. message ListMetricDescriptorsResponse {
  222. // The metric descriptors that are available to the project
  223. // and that match the value of `filter`, if present.
  224. repeated google.api.MetricDescriptor metric_descriptors = 1;
  225. // If there are more results than have been returned, then this field is set
  226. // to a non-empty value. To see the additional results,
  227. // use that value as `page_token` in the next call to this method.
  228. string next_page_token = 2;
  229. }
  230. // The `GetMetricDescriptor` request.
  231. message GetMetricDescriptorRequest {
  232. // Required. The metric descriptor on which to execute the request. The format is:
  233. //
  234. // projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
  235. //
  236. // An example value of `[METRIC_ID]` is
  237. // `"compute.googleapis.com/instance/disk/read_bytes_count"`.
  238. string name = 3 [
  239. (google.api.field_behavior) = REQUIRED,
  240. (google.api.resource_reference) = {
  241. type: "monitoring.googleapis.com/MetricDescriptor"
  242. }
  243. ];
  244. }
  245. // The `CreateMetricDescriptor` request.
  246. message CreateMetricDescriptorRequest {
  247. // Required. The project on which to execute the request. The format is:
  248. //
  249. // projects/[PROJECT_ID_OR_NUMBER]
  250. string name = 3 [
  251. (google.api.field_behavior) = REQUIRED,
  252. (google.api.resource_reference) = {
  253. child_type: "monitoring.googleapis.com/MetricDescriptor"
  254. }
  255. ];
  256. // Required. The new [custom metric](https://cloud.google.com/monitoring/custom-metrics)
  257. // descriptor.
  258. google.api.MetricDescriptor metric_descriptor = 2 [(google.api.field_behavior) = REQUIRED];
  259. }
  260. // The `DeleteMetricDescriptor` request.
  261. message DeleteMetricDescriptorRequest {
  262. // Required. The metric descriptor on which to execute the request. The format is:
  263. //
  264. // projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
  265. //
  266. // An example of `[METRIC_ID]` is:
  267. // `"custom.googleapis.com/my_test_metric"`.
  268. string name = 3 [
  269. (google.api.field_behavior) = REQUIRED,
  270. (google.api.resource_reference) = {
  271. type: "monitoring.googleapis.com/MetricDescriptor"
  272. }
  273. ];
  274. }
  275. // The `ListTimeSeries` request.
  276. message ListTimeSeriesRequest {
  277. // Controls which fields are returned by `ListTimeSeries`.
  278. enum TimeSeriesView {
  279. // Returns the identity of the metric(s), the time series,
  280. // and the time series data.
  281. FULL = 0;
  282. // Returns the identity of the metric and the time series resource,
  283. // but not the time series data.
  284. HEADERS = 1;
  285. }
  286. // Required. The project, organization or folder on which to execute the request. The
  287. // format is:
  288. //
  289. // projects/[PROJECT_ID_OR_NUMBER]
  290. // organizations/[ORGANIZATION_ID]
  291. // folders/[FOLDER_ID]
  292. string name = 10 [
  293. (google.api.field_behavior) = REQUIRED,
  294. (google.api.resource_reference) = {
  295. child_type: "monitoring.googleapis.com/TimeSeries"
  296. }
  297. ];
  298. // Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
  299. // that specifies which time series should be returned. The filter must
  300. // specify a single metric type, and can additionally specify metric labels
  301. // and other information. For example:
  302. //
  303. // metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
  304. // metric.labels.instance_name = "my-instance-name"
  305. string filter = 2 [(google.api.field_behavior) = REQUIRED];
  306. // Required. The time interval for which results should be returned. Only time series
  307. // that contain data points in the specified interval are included
  308. // in the response.
  309. TimeInterval interval = 4 [(google.api.field_behavior) = REQUIRED];
  310. // Specifies the alignment of data points in individual time series as
  311. // well as how to combine the retrieved time series across specified labels.
  312. //
  313. // By default (if no `aggregation` is explicitly specified), the raw time
  314. // series data is returned.
  315. Aggregation aggregation = 5;
  316. // Apply a second aggregation after `aggregation` is applied. May only be
  317. // specified if `aggregation` is specified.
  318. Aggregation secondary_aggregation = 11;
  319. // Unsupported: must be left blank. The points in each time series are
  320. // currently returned in reverse time order (most recent to oldest).
  321. string order_by = 6;
  322. // Required. Specifies which information is returned about the time series.
  323. TimeSeriesView view = 7 [(google.api.field_behavior) = REQUIRED];
  324. // A positive number that is the maximum number of results to return. If
  325. // `page_size` is empty or more than 100,000 results, the effective
  326. // `page_size` is 100,000 results. If `view` is set to `FULL`, this is the
  327. // maximum number of `Points` returned. If `view` is set to `HEADERS`, this is
  328. // the maximum number of `TimeSeries` returned.
  329. int32 page_size = 8;
  330. // If this field is not empty then it must contain the `nextPageToken` value
  331. // returned by a previous call to this method. Using this field causes the
  332. // method to return additional results from the previous method call.
  333. string page_token = 9;
  334. }
  335. // The `ListTimeSeries` response.
  336. message ListTimeSeriesResponse {
  337. // One or more time series that match the filter included in the request.
  338. repeated TimeSeries time_series = 1;
  339. // If there are more results than have been returned, then this field is set
  340. // to a non-empty value. To see the additional results,
  341. // use that value as `page_token` in the next call to this method.
  342. string next_page_token = 2;
  343. // Query execution errors that may have caused the time series data returned
  344. // to be incomplete.
  345. repeated google.rpc.Status execution_errors = 3;
  346. // The unit in which all `time_series` point values are reported. `unit`
  347. // follows the UCUM format for units as seen in
  348. // https://unitsofmeasure.org/ucum.html.
  349. // If different `time_series` have different units (for example, because they
  350. // come from different metric types, or a unit is absent), then `unit` will be
  351. // "{not_a_unit}".
  352. string unit = 5;
  353. }
  354. // The `CreateTimeSeries` request.
  355. message CreateTimeSeriesRequest {
  356. // Required. The project on which to execute the request. The format is:
  357. //
  358. // projects/[PROJECT_ID_OR_NUMBER]
  359. string name = 3 [
  360. (google.api.field_behavior) = REQUIRED,
  361. (google.api.resource_reference) = {
  362. type: "cloudresourcemanager.googleapis.com/Project"
  363. }
  364. ];
  365. // Required. The new data to be added to a list of time series.
  366. // Adds at most one data point to each of several time series. The new data
  367. // point must be more recent than any other point in its time series. Each
  368. // `TimeSeries` value must fully specify a unique time series by supplying
  369. // all label values for the metric and the monitored resource.
  370. //
  371. // The maximum number of `TimeSeries` objects per `Create` request is 200.
  372. repeated TimeSeries time_series = 2 [(google.api.field_behavior) = REQUIRED];
  373. }
  374. // DEPRECATED. Used to hold per-time-series error status.
  375. message CreateTimeSeriesError {
  376. // DEPRECATED. Time series ID that resulted in the `status` error.
  377. TimeSeries time_series = 1 [deprecated = true];
  378. // DEPRECATED. The status of the requested write operation for `time_series`.
  379. google.rpc.Status status = 2 [deprecated = true];
  380. }
  381. // Summary of the result of a failed request to write data to a time series.
  382. message CreateTimeSeriesSummary {
  383. // Detailed information about an error category.
  384. message Error {
  385. // The status of the requested write operation.
  386. google.rpc.Status status = 1;
  387. // The number of points that couldn't be written because of `status`.
  388. int32 point_count = 2;
  389. }
  390. // The number of points in the request.
  391. int32 total_point_count = 1;
  392. // The number of points that were successfully written.
  393. int32 success_point_count = 2;
  394. // The number of points that failed to be written. Order is not guaranteed.
  395. repeated Error errors = 3;
  396. }
  397. // The `QueryTimeSeries` request.
  398. message QueryTimeSeriesRequest {
  399. // Required. The project on which to execute the request. The format is:
  400. //
  401. // projects/[PROJECT_ID_OR_NUMBER]
  402. string name = 1;
  403. // Required. The query in the [Monitoring Query
  404. // Language](https://cloud.google.com/monitoring/mql/reference) format.
  405. // The default time zone is in UTC.
  406. string query = 7;
  407. // A positive number that is the maximum number of time_series_data to return.
  408. int32 page_size = 9;
  409. // If this field is not empty then it must contain the `nextPageToken` value
  410. // returned by a previous call to this method. Using this field causes the
  411. // method to return additional results from the previous method call.
  412. string page_token = 10;
  413. }
  414. // The `QueryTimeSeries` response.
  415. message QueryTimeSeriesResponse {
  416. // The descriptor for the time series data.
  417. TimeSeriesDescriptor time_series_descriptor = 8;
  418. // The time series data.
  419. repeated TimeSeriesData time_series_data = 9;
  420. // If there are more results than have been returned, then this field is set
  421. // to a non-empty value. To see the additional results, use that value as
  422. // `page_token` in the next call to this method.
  423. string next_page_token = 10;
  424. // Query execution errors that may have caused the time series data returned
  425. // to be incomplete. The available data will be available in the
  426. // response.
  427. repeated google.rpc.Status partial_errors = 11;
  428. }
  429. // This is an error detail intended to be used with INVALID_ARGUMENT errors.
  430. message QueryErrorList {
  431. // Errors in parsing the time series query language text. The number of errors
  432. // in the response may be limited.
  433. repeated QueryError errors = 1;
  434. // A summary of all the errors.
  435. string error_summary = 2;
  436. }