xref: /aosp_15_r20/external/googleapis/google/api/monitoring.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.api;
18
19option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
20option java_multiple_files = true;
21option java_outer_classname = "MonitoringProto";
22option java_package = "com.google.api";
23option objc_class_prefix = "GAPI";
24
25// Monitoring configuration of the service.
26//
27// The example below shows how to configure monitored resources and metrics
28// for monitoring. In the example, a monitored resource and two metrics are
29// defined. The `library.googleapis.com/book/returned_count` metric is sent
30// to both producer and consumer projects, whereas the
31// `library.googleapis.com/book/num_overdue` metric is only sent to the
32// consumer project.
33//
34//     monitored_resources:
35//     - type: library.googleapis.com/Branch
36//       display_name: "Library Branch"
37//       description: "A branch of a library."
38//       launch_stage: GA
39//       labels:
40//       - key: resource_container
41//         description: "The Cloud container (ie. project id) for the Branch."
42//       - key: location
43//         description: "The location of the library branch."
44//       - key: branch_id
45//         description: "The id of the branch."
46//     metrics:
47//     - name: library.googleapis.com/book/returned_count
48//       display_name: "Books Returned"
49//       description: "The count of books that have been returned."
50//       launch_stage: GA
51//       metric_kind: DELTA
52//       value_type: INT64
53//       unit: "1"
54//       labels:
55//       - key: customer_id
56//         description: "The id of the customer."
57//     - name: library.googleapis.com/book/num_overdue
58//       display_name: "Books Overdue"
59//       description: "The current number of overdue books."
60//       launch_stage: GA
61//       metric_kind: GAUGE
62//       value_type: INT64
63//       unit: "1"
64//       labels:
65//       - key: customer_id
66//         description: "The id of the customer."
67//     monitoring:
68//       producer_destinations:
69//       - monitored_resource: library.googleapis.com/Branch
70//         metrics:
71//         - library.googleapis.com/book/returned_count
72//       consumer_destinations:
73//       - monitored_resource: library.googleapis.com/Branch
74//         metrics:
75//         - library.googleapis.com/book/returned_count
76//         - library.googleapis.com/book/num_overdue
77message Monitoring {
78  // Configuration of a specific monitoring destination (the producer project
79  // or the consumer project).
80  message MonitoringDestination {
81    // The monitored resource type. The type must be defined in
82    // [Service.monitored_resources][google.api.Service.monitored_resources]
83    // section.
84    string monitored_resource = 1;
85
86    // Types of the metrics to report to this monitoring destination.
87    // Each type must be defined in
88    // [Service.metrics][google.api.Service.metrics] section.
89    repeated string metrics = 2;
90  }
91
92  // Monitoring configurations for sending metrics to the producer project.
93  // There can be multiple producer destinations. A monitored resource type may
94  // appear in multiple monitoring destinations if different aggregations are
95  // needed for different sets of metrics associated with that monitored
96  // resource type. A monitored resource and metric pair may only be used once
97  // in the Monitoring configuration.
98  repeated MonitoringDestination producer_destinations = 1;
99
100  // Monitoring configurations for sending metrics to the consumer project.
101  // There can be multiple consumer destinations. A monitored resource type may
102  // appear in multiple monitoring destinations if different aggregations are
103  // needed for different sets of metrics associated with that monitored
104  // resource type. A monitored resource and metric pair may only be used once
105  // in the Monitoring configuration.
106  repeated MonitoringDestination consumer_destinations = 2;
107}
108