metric_service.proto 17.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.monitoring.v3;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/metric.proto";
import "google/api/monitored_resource.proto";
import "google/api/resource.proto";
import "google/monitoring/v3/alert.proto";
import "google/monitoring/v3/common.proto";
import "google/monitoring/v3/metric.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/rpc/status.proto";

option csharp_namespace = "Google.Cloud.Monitoring.V3";
option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring";
option java_multiple_files = true;
option java_outer_classname = "MetricServiceProto";
option java_package = "com.google.monitoring.v3";
option php_namespace = "Google\\Cloud\\Monitoring\\V3";
option ruby_package = "Google::Cloud::Monitoring::V3";
option (google.api.resource_definition) = {
  type: "monitoring.googleapis.com/MetricDescriptor"
  pattern: "projects/{project}/metricDescriptors/{metric_descriptor=**}"
  pattern: "organizations/{organization}/metricDescriptors/{metric_descriptor=**}"
  pattern: "folders/{folder}/metricDescriptors/{metric_descriptor=**}"
  pattern: "*"
  history: ORIGINALLY_SINGLE_PATTERN
};
option (google.api.resource_definition) = {
  type: "monitoring.googleapis.com/MonitoredResourceDescriptor"
  pattern: "projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
  pattern: "organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
  pattern: "folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}"
  pattern: "*"
  history: ORIGINALLY_SINGLE_PATTERN
};

// Manages metric descriptors, monitored resource descriptors, and
// time series data.
service MetricService {
  option (google.api.default_host) = "monitoring.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform,"
      "https://www.googleapis.com/auth/monitoring,"
      "https://www.googleapis.com/auth/monitoring.read,"
      "https://www.googleapis.com/auth/monitoring.write";

  // Lists monitored resource descriptors that match a filter. This method does not require a Workspace.
  rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) {
    option (google.api.http) = {
      get: "/v3/{name=projects/*}/monitoredResourceDescriptors"
    };
    option (google.api.method_signature) = "name";
  }

  // Gets a single monitored resource descriptor. This method does not require a Workspace.
  rpc GetMonitoredResourceDescriptor(GetMonitoredResourceDescriptorRequest) returns (google.api.MonitoredResourceDescriptor) {
    option (google.api.http) = {
      get: "/v3/{name=projects/*/monitoredResourceDescriptors/**}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists metric descriptors that match a filter. This method does not require a Workspace.
  rpc ListMetricDescriptors(ListMetricDescriptorsRequest) returns (ListMetricDescriptorsResponse) {
    option (google.api.http) = {
      get: "/v3/{name=projects/*}/metricDescriptors"
    };
    option (google.api.method_signature) = "name";
  }

  // Gets a single metric descriptor. This method does not require a Workspace.
  rpc GetMetricDescriptor(GetMetricDescriptorRequest) returns (google.api.MetricDescriptor) {
    option (google.api.http) = {
      get: "/v3/{name=projects/*/metricDescriptors/**}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new metric descriptor.
  // User-created metric descriptors define
  // [custom metrics](https://cloud.google.com/monitoring/custom-metrics).
  rpc CreateMetricDescriptor(CreateMetricDescriptorRequest) returns (google.api.MetricDescriptor) {
    option (google.api.http) = {
      post: "/v3/{name=projects/*}/metricDescriptors"
      body: "metric_descriptor"
    };
    option (google.api.method_signature) = "name,metric_descriptor";
  }

  // Deletes a metric descriptor. Only user-created
  // [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be
  // deleted.
  rpc DeleteMetricDescriptor(DeleteMetricDescriptorRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v3/{name=projects/*/metricDescriptors/**}"
    };
    option (google.api.method_signature) = "name";
  }

  // Lists time series that match a filter. This method does not require a Workspace.
  rpc ListTimeSeries(ListTimeSeriesRequest) returns (ListTimeSeriesResponse) {
    option (google.api.http) = {
      get: "/v3/{name=projects/*}/timeSeries"
    };
    option (google.api.method_signature) = "name,filter,interval,view";
  }

  // Creates or adds data to one or more time series.
  // The response is empty if all time series in the request were written.
  // If any time series could not be written, a corresponding failure message is
  // included in the error response.
  rpc CreateTimeSeries(CreateTimeSeriesRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v3/{name=projects/*}/timeSeries"
      body: "*"
    };
    option (google.api.method_signature) = "name,time_series";
  }
}

// The `ListMonitoredResourceDescriptors` request.
message ListMonitoredResourceDescriptorsRequest {
  // Required. The project on which to execute the request. The format is:
  //
  //     projects/[PROJECT_ID_OR_NUMBER]
  string name = 5 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "monitoring.googleapis.com/MonitoredResourceDescriptor"
    }
  ];

  // An optional [filter](https://cloud.google.com/monitoring/api/v3/filters)
  // describing the descriptors to be returned.  The filter can reference the
  // descriptor's type and labels. For example, the following filter returns
  // only Google Compute Engine descriptors that have an `id` label:
  //
  //     resource.type = starts_with("gce_") AND resource.label:id
  string filter = 2;

  // A positive number that is the maximum number of results to return.
  int32 page_size = 3;

  // If this field is not empty then it must contain the `nextPageToken` value
  // returned by a previous call to this method.  Using this field causes the
  // method to return additional results from the previous method call.
  string page_token = 4;
}

// The `ListMonitoredResourceDescriptors` response.
message ListMonitoredResourceDescriptorsResponse {
  // The monitored resource descriptors that are available to this project
  // and that match `filter`, if present.
  repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1;

  // If there are more results than have been returned, then this field is set
  // to a non-empty value.  To see the additional results,
  // use that value as `page_token` in the next call to this method.
  string next_page_token = 2;
}

// The `GetMonitoredResourceDescriptor` request.
message GetMonitoredResourceDescriptorRequest {
  // Required. The monitored resource descriptor to get.  The format is:
  //
  //     projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE]
  //
  // The `[RESOURCE_TYPE]` is a predefined type, such as
  // `cloudsql_database`.
  string name = 3 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "monitoring.googleapis.com/MonitoredResourceDescriptor"
    }
  ];
}

// The `ListMetricDescriptors` request.
message ListMetricDescriptorsRequest {
  // Required. The project on which to execute the request. The format is:
  //
  //     projects/[PROJECT_ID_OR_NUMBER]
  string name = 5 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "monitoring.googleapis.com/MetricDescriptor"
    }
  ];

  // If this field is empty, all custom and
  // system-defined metric descriptors are returned.
  // Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters)
  // specifies which metric descriptors are to be
  // returned. For example, the following filter matches all
  // [custom metrics](https://cloud.google.com/monitoring/custom-metrics):
  //
  //     metric.type = starts_with("custom.googleapis.com/")
  string filter = 2;

  // A positive number that is the maximum number of results to return.
  int32 page_size = 3;

  // If this field is not empty then it must contain the `nextPageToken` value
  // returned by a previous call to this method.  Using this field causes the
  // method to return additional results from the previous method call.
  string page_token = 4;
}

// The `ListMetricDescriptors` response.
message ListMetricDescriptorsResponse {
  // The metric descriptors that are available to the project
  // and that match the value of `filter`, if present.
  repeated google.api.MetricDescriptor metric_descriptors = 1;

  // If there are more results than have been returned, then this field is set
  // to a non-empty value.  To see the additional results,
  // use that value as `page_token` in the next call to this method.
  string next_page_token = 2;
}

// The `GetMetricDescriptor` request.
message GetMetricDescriptorRequest {
  // Required. The metric descriptor on which to execute the request. The format is:
  //
  //     projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
  //
  // An example value of `[METRIC_ID]` is
  // `"compute.googleapis.com/instance/disk/read_bytes_count"`.
  string name = 3 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "monitoring.googleapis.com/MetricDescriptor"
    }
  ];
}

// The `CreateMetricDescriptor` request.
message CreateMetricDescriptorRequest {
  // Required. The project on which to execute the request. The format is:
  //
  //     projects/[PROJECT_ID_OR_NUMBER]
  string name = 3 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "monitoring.googleapis.com/MetricDescriptor"
    }
  ];

  // Required. The new [custom metric](https://cloud.google.com/monitoring/custom-metrics)
  // descriptor.
  google.api.MetricDescriptor metric_descriptor = 2 [(google.api.field_behavior) = REQUIRED];
}

// The `DeleteMetricDescriptor` request.
message DeleteMetricDescriptorRequest {
  // Required. The metric descriptor on which to execute the request. The format is:
  //
  //     projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID]
  //
  // An example of `[METRIC_ID]` is:
  // `"custom.googleapis.com/my_test_metric"`.
  string name = 3 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "monitoring.googleapis.com/MetricDescriptor"
    }
  ];
}

// The `ListTimeSeries` request.
message ListTimeSeriesRequest {
  // Controls which fields are returned by `ListTimeSeries`.
  enum TimeSeriesView {
    // Returns the identity of the metric(s), the time series,
    // and the time series data.
    FULL = 0;

    // Returns the identity of the metric and the time series resource,
    // but not the time series data.
    HEADERS = 1;
  }

  // Required. The project on which to execute the request. The format is:
  //
  //     projects/[PROJECT_ID_OR_NUMBER]
  string name = 10 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "cloudresourcemanager.googleapis.com/Project"
    }
  ];

  // Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
  // that specifies which time series should be returned.  The filter must
  // specify a single metric type, and can additionally specify metric labels
  // and other information. For example:
  //
  //     metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
  //         metric.labels.instance_name = "my-instance-name"
  string filter = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The time interval for which results should be returned. Only time series
  // that contain data points in the specified interval are included
  // in the response.
  TimeInterval interval = 4 [(google.api.field_behavior) = REQUIRED];

  // Specifies the alignment of data points in individual time series as
  // well as how to combine the retrieved time series across specified labels.
  //
  // By default (if no `aggregation` is explicitly specified), the raw time
  // series data is returned.
  Aggregation aggregation = 5;

  // Unsupported: must be left blank. The points in each time series are
  // currently returned in reverse time order (most recent to oldest).
  string order_by = 6;

  // Required. Specifies which information is returned about the time series.
  TimeSeriesView view = 7 [(google.api.field_behavior) = REQUIRED];

  // A positive number that is the maximum number of results to return. If
  // `page_size` is empty or more than 100,000 results, the effective
  // `page_size` is 100,000 results. If `view` is set to `FULL`, this is the
  // maximum number of `Points` returned. If `view` is set to `HEADERS`, this is
  // the maximum number of `TimeSeries` returned.
  int32 page_size = 8;

  // If this field is not empty then it must contain the `nextPageToken` value
  // returned by a previous call to this method.  Using this field causes the
  // method to return additional results from the previous method call.
  string page_token = 9;
}

// The `ListTimeSeries` response.
message ListTimeSeriesResponse {
  // One or more time series that match the filter included in the request.
  repeated TimeSeries time_series = 1;

  // If there are more results than have been returned, then this field is set
  // to a non-empty value.  To see the additional results,
  // use that value as `page_token` in the next call to this method.
  string next_page_token = 2;

  // Query execution errors that may have caused the time series data returned
  // to be incomplete.
  repeated google.rpc.Status execution_errors = 3;
}

// The `CreateTimeSeries` request.
message CreateTimeSeriesRequest {
  // Required. The project on which to execute the request. The format is:
  //
  //     projects/[PROJECT_ID_OR_NUMBER]
  string name = 3 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "cloudresourcemanager.googleapis.com/Project"
    }
  ];

  // Required. The new data to be added to a list of time series.
  // Adds at most one data point to each of several time series.  The new data
  // point must be more recent than any other point in its time series.  Each
  // `TimeSeries` value must fully specify a unique time series by supplying
  // all label values for the metric and the monitored resource.
  //
  // The maximum number of `TimeSeries` objects per `Create` request is 200.
  repeated TimeSeries time_series = 2 [(google.api.field_behavior) = REQUIRED];
}

// DEPRECATED. Used to hold per-time-series error status.
message CreateTimeSeriesError {
  // DEPRECATED. Time series ID that resulted in the `status` error.
  TimeSeries time_series = 1 [deprecated = true];

  // DEPRECATED. The status of the requested write operation for `time_series`.
  google.rpc.Status status = 2 [deprecated = true];
}

// Summary of the result of a failed request to write data to a time series.
message CreateTimeSeriesSummary {
  // Detailed information about an error category.
  message Error {
    // The status of the requested write operation.
    google.rpc.Status status = 1;

    // The number of points that couldn't be written because of `status`.
    int32 point_count = 2;
  }

  // The number of points in the request.
  int32 total_point_count = 1;

  // The number of points that were successfully written.
  int32 success_point_count = 2;

  // The number of points that failed to be written. Order is not guaranteed.
  repeated Error errors = 3;
}

// The `QueryTimeSeries` request.
message QueryTimeSeriesRequest {
  // Required. The project on which to execute the request. The format is:
  //
  //     projects/[PROJECT_ID_OR_NUMBER]
  string name = 1;

  // Required. The query in the monitoring query language format. The default
  // time zone is in UTC.
  string query = 7;

  // A positive number that is the maximum number of time_series_data to return.
  int32 page_size = 9;

  // If this field is not empty then it must contain the `nextPageToken` value
  // returned by a previous call to this method.  Using this field causes the
  // method to return additional results from the previous method call.
  string page_token = 10;
}

// The `QueryTimeSeries` response.
message QueryTimeSeriesResponse {
  // The descriptor for the time series data.
  TimeSeriesDescriptor time_series_descriptor = 8;

  // The time series data.
  repeated TimeSeriesData time_series_data = 9;

  // If there are more results than have been returned, then this field is set
  // to a non-empty value.  To see the additional results, use that value as
  // `page_token` in the next call to this method.
  string next_page_token = 10;

  // Query execution errors that may have caused the time series data returned
  // to be incomplete. The available data will be available in the
  // response.
  repeated google.rpc.Status partial_errors = 11;
}

// This is an error detail intended to be used with INVALID_ARGUMENT errors.
message QueryErrorList {
  // Errors in parsing the time series query language text. The number of errors
  // in the response may be limited.
  repeated QueryError errors = 1;

  // A summary of all the errors.
  string error_summary = 2;
}