xref: /aosp_15_r20/external/googleapis/google/monitoring/v3/service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/protobuf/duration.proto";
22import "google/type/calendar_period.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 = "ServiceMonitoringProto";
28option java_package = "com.google.monitoring.v3";
29option php_namespace = "Google\\Cloud\\Monitoring\\V3";
30option ruby_package = "Google::Cloud::Monitoring::V3";
31
32// A `Service` is a discrete, autonomous, and network-accessible unit, designed
33// to solve an individual concern
34// ([Wikipedia](https://en.wikipedia.org/wiki/Service-orientation)). In
35// Cloud Monitoring, a `Service` acts as the root resource under which
36// operational aspects of the service are accessible.
37message Service {
38  option (google.api.resource) = {
39    type: "monitoring.googleapis.com/Service"
40    pattern: "projects/{project}/services/{service}"
41    pattern: "organizations/{organization}/services/{service}"
42    pattern: "folders/{folder}/services/{service}"
43    pattern: "*"
44  };
45
46  // Use a custom service to designate a service that you want to monitor
47  // when none of the other service types (like App Engine, Cloud Run, or
48  // a GKE type) matches your intended service.
49  message Custom {}
50
51  // App Engine service. Learn more at https://cloud.google.com/appengine.
52  message AppEngine {
53    // The ID of the App Engine module underlying this service. Corresponds to
54    // the `module_id` resource label in the [`gae_app` monitored
55    // resource](https://cloud.google.com/monitoring/api/resources#tag_gae_app).
56    string module_id = 1;
57  }
58
59  // Cloud Endpoints service. Learn more at https://cloud.google.com/endpoints.
60  message CloudEndpoints {
61    // The name of the Cloud Endpoints service underlying this service.
62    // Corresponds to the `service` resource label in the [`api` monitored
63    // resource](https://cloud.google.com/monitoring/api/resources#tag_api).
64    string service = 1;
65  }
66
67  // Istio service scoped to a single Kubernetes cluster. Learn more at
68  // https://istio.io. Clusters running OSS Istio will have their services
69  // ingested as this type.
70  message ClusterIstio {
71    // The location of the Kubernetes cluster in which this Istio service is
72    // defined. Corresponds to the `location` resource label in `k8s_cluster`
73    // resources.
74    string location = 1;
75
76    // The name of the Kubernetes cluster in which this Istio service is
77    // defined. Corresponds to the `cluster_name` resource label in
78    // `k8s_cluster` resources.
79    string cluster_name = 2;
80
81    // The namespace of the Istio service underlying this service. Corresponds
82    // to the `destination_service_namespace` metric label in Istio metrics.
83    string service_namespace = 3;
84
85    // The name of the Istio service underlying this service. Corresponds to the
86    // `destination_service_name` metric label in Istio metrics.
87    string service_name = 4;
88  }
89
90  // Istio service scoped to an Istio mesh. Anthos clusters running ASM < 1.6.8
91  // will have their services ingested as this type.
92  message MeshIstio {
93    // Identifier for the mesh in which this Istio service is defined.
94    // Corresponds to the `mesh_uid` metric label in Istio metrics.
95    string mesh_uid = 1;
96
97    // The namespace of the Istio service underlying this service. Corresponds
98    // to the `destination_service_namespace` metric label in Istio metrics.
99    string service_namespace = 3;
100
101    // The name of the Istio service underlying this service. Corresponds to the
102    // `destination_service_name` metric label in Istio metrics.
103    string service_name = 4;
104  }
105
106  // Canonical service scoped to an Istio mesh. Anthos clusters running ASM >=
107  // 1.6.8 will have their services ingested as this type.
108  message IstioCanonicalService {
109    // Identifier for the Istio mesh in which this canonical service is defined.
110    // Corresponds to the `mesh_uid` metric label in
111    // [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio).
112    string mesh_uid = 1;
113
114    // The namespace of the canonical service underlying this service.
115    // Corresponds to the `destination_canonical_service_namespace` metric
116    // label in [Istio
117    // metrics](https://cloud.google.com/monitoring/api/metrics_istio).
118    string canonical_service_namespace = 3;
119
120    // The name of the canonical service underlying this service.
121    // Corresponds to the `destination_canonical_service_name` metric label in
122    // label in [Istio
123    // metrics](https://cloud.google.com/monitoring/api/metrics_istio).
124    string canonical_service = 4;
125  }
126
127  // Cloud Run service. Learn more at https://cloud.google.com/run.
128  message CloudRun {
129    // The name of the Cloud Run service. Corresponds to the `service_name`
130    // resource label in the [`cloud_run_revision` monitored
131    // resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision).
132    string service_name = 1;
133
134    // The location the service is run. Corresponds to the `location`
135    // resource label in the [`cloud_run_revision` monitored
136    // resource](https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision).
137    string location = 2;
138  }
139
140  // GKE Namespace. The field names correspond to the resource metadata labels
141  // on monitored resources that fall under a namespace (for example,
142  // `k8s_container` or `k8s_pod`).
143  message GkeNamespace {
144    // Output only. The project this resource lives in. For legacy services
145    // migrated from the `Custom` type, this may be a distinct project from the
146    // one parenting the service itself.
147    string project_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
148
149    // The location of the parent cluster. This may be a zone or region.
150    string location = 2;
151
152    // The name of the parent cluster.
153    string cluster_name = 3;
154
155    // The name of this namespace.
156    string namespace_name = 4;
157  }
158
159  // A GKE Workload (Deployment, StatefulSet, etc). The field names correspond
160  // to the metadata labels on monitored resources that fall under a workload
161  // (for example, `k8s_container` or `k8s_pod`).
162  message GkeWorkload {
163    // Output only. The project this resource lives in. For legacy services
164    // migrated from the `Custom` type, this may be a distinct project from the
165    // one parenting the service itself.
166    string project_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
167
168    // The location of the parent cluster. This may be a zone or region.
169    string location = 2;
170
171    // The name of the parent cluster.
172    string cluster_name = 3;
173
174    // The name of the parent namespace.
175    string namespace_name = 4;
176
177    // The type of this workload (for example, "Deployment" or "DaemonSet")
178    string top_level_controller_type = 5;
179
180    // The name of this workload.
181    string top_level_controller_name = 6;
182  }
183
184  // GKE Service. The "service" here represents a
185  // [Kubernetes service
186  // object](https://kubernetes.io/docs/concepts/services-networking/service).
187  // The field names correspond to the resource labels on [`k8s_service`
188  // monitored
189  // resources](https://cloud.google.com/monitoring/api/resources#tag_k8s_service).
190  message GkeService {
191    // Output only. The project this resource lives in. For legacy services
192    // migrated from the `Custom` type, this may be a distinct project from the
193    // one parenting the service itself.
194    string project_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
195
196    // The location of the parent cluster. This may be a zone or region.
197    string location = 2;
198
199    // The name of the parent cluster.
200    string cluster_name = 3;
201
202    // The name of the parent namespace.
203    string namespace_name = 4;
204
205    // The name of this service.
206    string service_name = 5;
207  }
208
209  // A well-known service type, defined by its service type and service labels.
210  // Documentation and examples
211  // [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
212  message BasicService {
213    // The type of service that this basic service defines, e.g.
214    // APP_ENGINE service type.
215    // Documentation and valid values
216    // [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
217    string service_type = 1;
218
219    // Labels that specify the resource that emits the monitoring data which
220    // is used for SLO reporting of this `Service`.
221    // Documentation and valid values for given service types
222    // [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
223    map<string, string> service_labels = 2;
224  }
225
226  // Configuration for how to query telemetry on a Service.
227  message Telemetry {
228    // The full name of the resource that defines this service. Formatted as
229    // described in https://cloud.google.com/apis/design/resource_names.
230    string resource_name = 1;
231  }
232
233  // Identifier. Resource name for this Service. The format is:
234  //
235  //     projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
236  string name = 1 [(google.api.field_behavior) = IDENTIFIER];
237
238  // Name used for UI elements listing this Service.
239  string display_name = 2;
240
241  // REQUIRED. Service-identifying atoms specifying the underlying service.
242  oneof identifier {
243    // Custom service type.
244    Custom custom = 6;
245
246    // Type used for App Engine services.
247    AppEngine app_engine = 7;
248
249    // Type used for Cloud Endpoints services.
250    CloudEndpoints cloud_endpoints = 8;
251
252    // Type used for Istio services that live in a Kubernetes cluster.
253    ClusterIstio cluster_istio = 9;
254
255    // Type used for Istio services scoped to an Istio mesh.
256    MeshIstio mesh_istio = 10;
257
258    // Type used for canonical services scoped to an Istio mesh.
259    // Metrics for Istio are
260    // [documented here](https://istio.io/latest/docs/reference/config/metrics/)
261    IstioCanonicalService istio_canonical_service = 11;
262
263    // Type used for Cloud Run services.
264    CloudRun cloud_run = 12;
265
266    // Type used for GKE Namespaces.
267    GkeNamespace gke_namespace = 15;
268
269    // Type used for GKE Workloads.
270    GkeWorkload gke_workload = 16;
271
272    // Type used for GKE Services (the Kubernetes concept of a service).
273    GkeService gke_service = 17;
274  }
275
276  // Message that contains the service type and service labels of this service
277  // if it is a basic service.
278  // Documentation and examples
279  // [here](https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).
280  BasicService basic_service = 19;
281
282  // Configuration for how to query telemetry on a Service.
283  Telemetry telemetry = 13;
284
285  // Labels which have been used to annotate the service. Label keys must start
286  // with a letter. Label keys and values may contain lowercase letters,
287  // numbers, underscores, and dashes. Label keys and values have a maximum
288  // length of 63 characters, and must be less than 128 bytes in size. Up to 64
289  // label entries may be stored. For labels which do not have a semantic value,
290  // the empty string may be supplied for the label value.
291  map<string, string> user_labels = 14;
292}
293
294// A Service-Level Objective (SLO) describes a level of desired good service. It
295// consists of a service-level indicator (SLI), a performance goal, and a period
296// over which the objective is to be evaluated against that goal. The SLO can
297// use SLIs defined in a number of different manners. Typical SLOs might include
298// "99% of requests in each rolling week have latency below 200 milliseconds" or
299// "99.5% of requests in each calendar month return successfully."
300message ServiceLevelObjective {
301  option (google.api.resource) = {
302    type: "monitoring.googleapis.com/ServiceLevelObjective"
303    pattern: "projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}"
304    pattern: "organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}"
305    pattern: "folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}"
306    pattern: "*"
307    history: ORIGINALLY_SINGLE_PATTERN
308  };
309
310  // `ServiceLevelObjective.View` determines what form of
311  // `ServiceLevelObjective` is returned from `GetServiceLevelObjective`,
312  // `ListServiceLevelObjectives`, and `ListServiceLevelObjectiveVersions` RPCs.
313  enum View {
314    // Same as FULL.
315    VIEW_UNSPECIFIED = 0;
316
317    // Return the embedded `ServiceLevelIndicator` in the form in which it was
318    // defined. If it was defined using a `BasicSli`, return that `BasicSli`.
319    FULL = 2;
320
321    // For `ServiceLevelIndicator`s using `BasicSli` articulation, instead
322    // return the `ServiceLevelIndicator` with its mode of computation fully
323    // spelled out as a `RequestBasedSli`. For `ServiceLevelIndicator`s using
324    // `RequestBasedSli` or `WindowsBasedSli`, return the
325    // `ServiceLevelIndicator` as it was provided.
326    EXPLICIT = 1;
327  }
328
329  // Identifier. Resource name for this `ServiceLevelObjective`. The format is:
330  //
331  //     projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]
332  string name = 1 [(google.api.field_behavior) = IDENTIFIER];
333
334  // Name used for UI elements listing this SLO.
335  string display_name = 11;
336
337  // The definition of good service, used to measure and calculate the quality
338  // of the `Service`'s performance with respect to a single aspect of service
339  // quality.
340  ServiceLevelIndicator service_level_indicator = 3;
341
342  // The fraction of service that must be good in order for this objective to be
343  // met. `0 < goal <= 0.999`.
344  double goal = 4;
345
346  // The time period over which the objective will be evaluated.
347  oneof period {
348    // A rolling time period, semantically "in the past `<rolling_period>`".
349    // Must be an integer multiple of 1 day no larger than 30 days.
350    google.protobuf.Duration rolling_period = 5;
351
352    // A calendar period, semantically "since the start of the current
353    // `<calendar_period>`". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and
354    // `MONTH` are supported.
355    google.type.CalendarPeriod calendar_period = 6;
356  }
357
358  // Labels which have been used to annotate the service-level objective. Label
359  // keys must start with a letter. Label keys and values may contain lowercase
360  // letters, numbers, underscores, and dashes. Label keys and values have a
361  // maximum length of 63 characters, and must be less than 128 bytes in size.
362  // Up to 64 label entries may be stored. For labels which do not have a
363  // semantic value, the empty string may be supplied for the label value.
364  map<string, string> user_labels = 12;
365}
366
367// A Service-Level Indicator (SLI) describes the "performance" of a service. For
368// some services, the SLI is well-defined. In such cases, the SLI can be
369// described easily by referencing the well-known SLI and providing the needed
370// parameters. Alternatively, a "custom" SLI can be defined with a query to the
371// underlying metric store. An SLI is defined to be `good_service /
372// total_service` over any queried time interval. The value of performance
373// always falls into the range `0 <= performance <= 1`. A custom SLI describes
374// how to compute this ratio, whether this is by dividing values from a pair of
375// time series, cutting a `Distribution` into good and bad counts, or counting
376// time windows in which the service complies with a criterion. For separation
377// of concerns, a single Service-Level Indicator measures performance for only
378// one aspect of service quality, such as fraction of successful queries or
379// fast-enough queries.
380message ServiceLevelIndicator {
381  // Service level indicators can be grouped by whether the "unit" of service
382  // being measured is based on counts of good requests or on counts of good
383  // time windows
384  oneof type {
385    // Basic SLI on a well-known service type.
386    BasicSli basic_sli = 4;
387
388    // Request-based SLIs
389    RequestBasedSli request_based = 1;
390
391    // Windows-based SLIs
392    WindowsBasedSli windows_based = 2;
393  }
394}
395
396// An SLI measuring performance on a well-known service type. Performance will
397// be computed on the basis of pre-defined metrics. The type of the
398// `service_resource` determines the metrics to use and the
399// `service_resource.labels` and `metric_labels` are used to construct a
400// monitoring filter to filter that metric down to just the data relevant to
401// this service.
402message BasicSli {
403  // Future parameters for the availability SLI.
404  message AvailabilityCriteria {}
405
406  // Parameters for a latency threshold SLI.
407  message LatencyCriteria {
408    // Good service is defined to be the count of requests made to this service
409    // that return in no more than `threshold`.
410    google.protobuf.Duration threshold = 3;
411  }
412
413  // OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from
414  // other methods will not be used to calculate performance for this SLI. If
415  // omitted, this SLI applies to all the Service's methods. For service types
416  // that don't support breaking down by method, setting this field will result
417  // in an error.
418  repeated string method = 7;
419
420  // OPTIONAL: The set of locations to which this SLI is relevant. Telemetry
421  // from other locations will not be used to calculate performance for this
422  // SLI. If omitted, this SLI applies to all locations in which the Service has
423  // activity. For service types that don't support breaking down by location,
424  // setting this field will result in an error.
425  repeated string location = 8;
426
427  // OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry
428  // from other API versions will not be used to calculate performance for this
429  // SLI. If omitted, this SLI applies to all API versions. For service types
430  // that don't support breaking down by version, setting this field will result
431  // in an error.
432  repeated string version = 9;
433
434  // This SLI can be evaluated on the basis of availability or latency.
435  oneof sli_criteria {
436    // Good service is defined to be the count of requests made to this service
437    // that return successfully.
438    AvailabilityCriteria availability = 2;
439
440    // Good service is defined to be the count of requests made to this service
441    // that are fast enough with respect to `latency.threshold`.
442    LatencyCriteria latency = 3;
443  }
444}
445
446// Range of numerical values within `min` and `max`.
447message Range {
448  // Range minimum.
449  double min = 1;
450
451  // Range maximum.
452  double max = 2;
453}
454
455// Service Level Indicators for which atomic units of service are counted
456// directly.
457message RequestBasedSli {
458  // The means to compute a ratio of `good_service` to `total_service`.
459  oneof method {
460    // `good_total_ratio` is used when the ratio of `good_service` to
461    // `total_service` is computed from two `TimeSeries`.
462    TimeSeriesRatio good_total_ratio = 1;
463
464    // `distribution_cut` is used when `good_service` is a count of values
465    // aggregated in a `Distribution` that fall into a good range. The
466    // `total_service` is the total count of all values aggregated in the
467    // `Distribution`.
468    DistributionCut distribution_cut = 3;
469  }
470}
471
472// A `TimeSeriesRatio` specifies two `TimeSeries` to use for computing the
473// `good_service / total_service` ratio. The specified `TimeSeries` must have
474// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
475// DELTA` or `MetricKind = CUMULATIVE`. The `TimeSeriesRatio` must specify
476// exactly two of good, bad, and total, and the relationship `good_service +
477// bad_service = total_service` will be assumed.
478message TimeSeriesRatio {
479  // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
480  // specifying a `TimeSeries` quantifying good service provided. Must have
481  // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
482  // DELTA` or `MetricKind = CUMULATIVE`.
483  string good_service_filter = 4;
484
485  // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
486  // specifying a `TimeSeries` quantifying bad service, either demanded service
487  // that was not provided or demanded service that was of inadequate quality.
488  // Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have
489  // `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
490  string bad_service_filter = 5;
491
492  // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
493  // specifying a `TimeSeries` quantifying total demanded service. Must have
494  // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind =
495  // DELTA` or `MetricKind = CUMULATIVE`.
496  string total_service_filter = 6;
497}
498
499// A `DistributionCut` defines a `TimeSeries` and thresholds used for measuring
500// good service and total service. The `TimeSeries` must have `ValueType =
501// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. The
502// computed `good_service` will be the estimated count of values in the
503// `Distribution` that fall within the specified `min` and `max`.
504message DistributionCut {
505  // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
506  // specifying a `TimeSeries` aggregating values. Must have `ValueType =
507  // DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`.
508  string distribution_filter = 4;
509
510  // Range of values considered "good." For a one-sided range, set one bound to
511  // an infinite value.
512  Range range = 5;
513}
514
515// A `WindowsBasedSli` defines `good_service` as the count of time windows for
516// which the provided service was of good quality. Criteria for determining
517// if service was good are embedded in the `window_criterion`.
518message WindowsBasedSli {
519  // A `PerformanceThreshold` is used when each window is good when that window
520  // has a sufficiently high `performance`.
521  message PerformanceThreshold {
522    // The means, either a request-based SLI or a basic SLI, by which to compute
523    // performance over a window.
524    oneof type {
525      // `RequestBasedSli` to evaluate to judge window quality.
526      RequestBasedSli performance = 1;
527
528      // `BasicSli` to evaluate to judge window quality.
529      BasicSli basic_sli_performance = 3;
530    }
531
532    // If window `performance >= threshold`, the window is counted as good.
533    double threshold = 2;
534  }
535
536  // A `MetricRange` is used when each window is good when the value x of a
537  // single `TimeSeries` satisfies `range.min <= x <= range.max`. The provided
538  // `TimeSeries` must have `ValueType = INT64` or `ValueType = DOUBLE` and
539  // `MetricKind = GAUGE`.
540  message MetricRange {
541    // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
542    // specifying the `TimeSeries` to use for evaluating window quality.
543    string time_series = 1;
544
545    // Range of values considered "good." For a one-sided range, set one bound
546    // to an infinite value.
547    Range range = 4;
548  }
549
550  // The criterion to use for evaluating window goodness.
551  oneof window_criterion {
552    // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
553    // specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if
554    // any `true` values appear in the window.
555    string good_bad_metric_filter = 5;
556
557    // A window is good if its `performance` is high enough.
558    PerformanceThreshold good_total_ratio_threshold = 2;
559
560    // A window is good if the metric's value is in a good range, averaged
561    // across returned streams.
562    MetricRange metric_mean_in_range = 6;
563
564    // A window is good if the metric's value is in a good range, summed across
565    // returned streams.
566    MetricRange metric_sum_in_range = 7;
567  }
568
569  // Duration over which window quality is evaluated. Must be an integer
570  // fraction of a day and at least `60s`.
571  google.protobuf.Duration window_period = 4;
572}
573