metric_service.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. // Copyright 2016 Google Inc.
  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/metric.proto";
  18. import "google/api/monitored_resource.proto";
  19. import "google/monitoring/v3/common.proto";
  20. import "google/monitoring/v3/metric.proto";
  21. import "google/protobuf/empty.proto";
  22. import "google/rpc/status.proto";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "MetricServiceProto";
  25. option java_package = "com.google.monitoring.v3";
  26. // Manages metric descriptors, monitored resource descriptors, and
  27. // time series data.
  28. service MetricService {
  29. // Lists monitored resource descriptors that match a filter.
  30. rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) {
  31. option (google.api.http) = { get: "/v3/{name=projects/*}/monitoredResourceDescriptors" };
  32. }
  33. // Gets a single monitored resource descriptor.
  34. rpc GetMonitoredResourceDescriptor(GetMonitoredResourceDescriptorRequest) returns (google.api.MonitoredResourceDescriptor) {
  35. option (google.api.http) = { get: "/v3/{name=projects/*/monitoredResourceDescriptors/*}" };
  36. }
  37. // Lists metric descriptors that match a filter.
  38. rpc ListMetricDescriptors(ListMetricDescriptorsRequest) returns (ListMetricDescriptorsResponse) {
  39. option (google.api.http) = { get: "/v3/{name=projects/*}/metricDescriptors" };
  40. }
  41. // Gets a single metric descriptor.
  42. rpc GetMetricDescriptor(GetMetricDescriptorRequest) returns (google.api.MetricDescriptor) {
  43. option (google.api.http) = { get: "/v3/{name=projects/*/metricDescriptors/**}" };
  44. }
  45. // Creates a new metric descriptor.
  46. // User-created metric descriptors define
  47. // [custom metrics](/monitoring/custom-metrics).
  48. rpc CreateMetricDescriptor(CreateMetricDescriptorRequest) returns (google.api.MetricDescriptor) {
  49. option (google.api.http) = { post: "/v3/{name=projects/*}/metricDescriptors", body: "metric_descriptor" };
  50. }
  51. // Deletes a metric descriptor. Only user-created
  52. // [custom metrics](/monitoring/custom-metrics) can be deleted.
  53. rpc DeleteMetricDescriptor(DeleteMetricDescriptorRequest) returns (google.protobuf.Empty) {
  54. option (google.api.http) = { delete: "/v3/{name=projects/*/metricDescriptors/**}" };
  55. }
  56. // Lists time series that match a filter.
  57. rpc ListTimeSeries(ListTimeSeriesRequest) returns (ListTimeSeriesResponse) {
  58. option (google.api.http) = { get: "/v3/{name=projects/*}/timeSeries" };
  59. }
  60. // Creates or adds data to one or more time series.
  61. // The response is empty if all time series in the request were written.
  62. // If any time series could not be written, a corresponding failure message is
  63. // included in the error response.
  64. rpc CreateTimeSeries(CreateTimeSeriesRequest) returns (google.protobuf.Empty) {
  65. option (google.api.http) = { post: "/v3/{name=projects/*}/timeSeries", body: "*" };
  66. }
  67. }
  68. // The `ListMonitoredResourceDescriptors` request.
  69. message ListMonitoredResourceDescriptorsRequest {
  70. // The project on which to execute the request. The format is
  71. // `"projects/{project_id_or_number}"`.
  72. string name = 5;
  73. // An optional [filter](/monitoring/api/v3/filters) describing
  74. // the descriptors to be returned. The filter can reference
  75. // the descriptor's type and labels. For example, the
  76. // following filter returns only Google Compute Engine descriptors
  77. // that have an `id` label:
  78. //
  79. // resource.type = starts_with("gce_") AND resource.label:id
  80. string filter = 2;
  81. // A positive number that is the maximum number of results to return.
  82. int32 page_size = 3;
  83. // If this field is not empty then it must contain the `nextPageToken` value
  84. // returned by a previous call to this method. Using this field causes the
  85. // method to return additional results from the previous method call.
  86. string page_token = 4;
  87. }
  88. // The `ListMonitoredResourcDescriptors` response.
  89. message ListMonitoredResourceDescriptorsResponse {
  90. // The monitored resource descriptors that are available to this project
  91. // and that match `filter`, if present.
  92. repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1;
  93. // If there are more results than have been returned, then this field is set
  94. // to a non-empty value. To see the additional results,
  95. // use that value as `pageToken` in the next call to this method.
  96. string next_page_token = 2;
  97. }
  98. // The `GetMonitoredResourceDescriptor` request.
  99. message GetMonitoredResourceDescriptorRequest {
  100. // The monitored resource descriptor to get. The format is
  101. // `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`.
  102. // The `{resource_type}` is a predefined type, such as
  103. // `cloudsql_database`.
  104. string name = 3;
  105. }
  106. // The `ListMetricDescriptors` request.
  107. message ListMetricDescriptorsRequest {
  108. // The project on which to execute the request. The format is
  109. // `"projects/{project_id_or_number}"`.
  110. string name = 5;
  111. // If this field is empty, all custom and
  112. // system-defined metric descriptors are returned.
  113. // Otherwise, the [filter](/monitoring/api/v3/filters)
  114. // specifies which metric descriptors are to be
  115. // returned. For example, the following filter matches all
  116. // [custom metrics](/monitoring/custom-metrics):
  117. //
  118. // metric.type = starts_with("custom.googleapis.com/")
  119. string filter = 2;
  120. // A positive number that is the maximum number of results to return.
  121. int32 page_size = 3;
  122. // If this field is not empty then it must contain the `nextPageToken` value
  123. // returned by a previous call to this method. Using this field causes the
  124. // method to return additional results from the previous method call.
  125. string page_token = 4;
  126. }
  127. // The `ListMetricDescriptors` response.
  128. message ListMetricDescriptorsResponse {
  129. // The metric descriptors that are available to the project
  130. // and that match the value of `filter`, if present.
  131. repeated google.api.MetricDescriptor metric_descriptors = 1;
  132. // If there are more results than have been returned, then this field is set
  133. // to a non-empty value. To see the additional results,
  134. // use that value as `pageToken` in the next call to this method.
  135. string next_page_token = 2;
  136. }
  137. // The `GetMetricDescriptor` request.
  138. message GetMetricDescriptorRequest {
  139. // The metric descriptor on which to execute the request. The format is
  140. // `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`.
  141. // An example value of `{metric_id}` is
  142. // `"compute.googleapis.com/instance/disk/read_bytes_count"`.
  143. string name = 3;
  144. }
  145. // The `CreateMetricDescriptor` request.
  146. message CreateMetricDescriptorRequest {
  147. // The project on which to execute the request. The format is
  148. // `"projects/{project_id_or_number}"`.
  149. string name = 3;
  150. // The new [custom metric](/monitoring/custom-metrics)
  151. // descriptor.
  152. google.api.MetricDescriptor metric_descriptor = 2;
  153. }
  154. // The `DeleteMetricDescriptor` request.
  155. message DeleteMetricDescriptorRequest {
  156. // The metric descriptor on which to execute the request. The format is
  157. // `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`.
  158. // An example of `{metric_id}` is:
  159. // `"custom.googleapis.com/my_test_metric"`.
  160. string name = 3;
  161. }
  162. // The `ListTimeSeries` request.
  163. message ListTimeSeriesRequest {
  164. // Controls which fields are returned by `ListTimeSeries`.
  165. enum TimeSeriesView {
  166. // Returns the identity of the metric(s), the time series,
  167. // and the time series data.
  168. FULL = 0;
  169. // Returns the identity of the metric and the time series resource,
  170. // but not the time series data.
  171. HEADERS = 1;
  172. }
  173. // The project on which to execute the request. The format is
  174. // "projects/{project_id_or_number}".
  175. string name = 10;
  176. // A [monitoring filter](/monitoring/api/v3/filters) that specifies which time
  177. // series should be returned. The filter must specify a single metric type,
  178. // and can additionally specify metric labels and other information. For
  179. // example:
  180. //
  181. // metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
  182. // metric.label.instance_name = "my-instance-name"
  183. string filter = 2;
  184. // The time interval for which results should be returned. Only time series
  185. // that contain data points in the specified interval are included
  186. // in the response.
  187. TimeInterval interval = 4;
  188. // By default, the raw time series data is returned.
  189. // Use this field to combine multiple time series for different
  190. // views of the data.
  191. Aggregation aggregation = 5;
  192. // Specifies the order in which the points of the time series should
  193. // be returned. By default, results are not ordered. Currently,
  194. // this field must be left blank.
  195. string order_by = 6;
  196. // Specifies which information is returned about the time series.
  197. TimeSeriesView view = 7;
  198. // A positive number that is the maximum number of results to return.
  199. // When `view` field sets to `FULL`, it limits the number of `Points` server
  200. // will return; if `view` field is `HEADERS`, it limits the number of
  201. // `TimeSeries` server will return.
  202. int32 page_size = 8;
  203. // If this field is not empty then it must contain the `nextPageToken` value
  204. // returned by a previous call to this method. Using this field causes the
  205. // method to return additional results from the previous method call.
  206. string page_token = 9;
  207. }
  208. // The `ListTimeSeries` response.
  209. message ListTimeSeriesResponse {
  210. // One or more time series that match the filter included in the request.
  211. repeated TimeSeries time_series = 1;
  212. // If there are more results than have been returned, then this field is set
  213. // to a non-empty value. To see the additional results,
  214. // use that value as `pageToken` in the next call to this method.
  215. string next_page_token = 2;
  216. }
  217. // The `CreateTimeSeries` request.
  218. message CreateTimeSeriesRequest {
  219. // The project on which to execute the request. The format is
  220. // `"projects/{project_id_or_number}"`.
  221. string name = 3;
  222. // The new data to be added to a list of time series.
  223. // Adds at most one data point to each of several time series. The new data
  224. // point must be more recent than any other point in its time series. Each
  225. // `TimeSeries` value must fully specify a unique time series by supplying
  226. // all label values for the metric and the monitored resource.
  227. repeated TimeSeries time_series = 2;
  228. }
  229. // Describes the result of a failed request to write data to a time series.
  230. message CreateTimeSeriesError {
  231. // The time series, including the `Metric`, `MonitoredResource`,
  232. // and `Point`s (including timestamp and value) that resulted
  233. // in the error. This field provides all of the context that
  234. // would be needed to retry the operation.
  235. TimeSeries time_series = 1;
  236. // The status of the requested write operation.
  237. google.rpc.Status status = 2;
  238. }