metric_service.proto 20 KB

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