Skip to content

Commit 354d076

Browse files
Google APIscopybara-github
authored andcommitted
feat: Added support for logs-based alerts:
https://cloud.google.com/logging/docs/alerting/log-based-alerts feat: Added support for user-defined labels on cloud monitoring's Service and ServiceLevelObjective objects fix!: mark required fields in QueryTimeSeriesRequest as required PiperOrigin-RevId: 393200011
1 parent 9e36f4e commit 354d076

18 files changed

Lines changed: 172 additions & 86 deletions

google/monitoring/dashboard/v1/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# This file was automatically generated by BuildFileGenerator
2-
# except for the gapic_yaml field in the java_gapic_library
3-
# and the C++ rules at the end of the file.
42
# https://github.com/googleapis/rules_gapic/tree/master/bazel
53

64
# Most of the manual changes to this file will be overwritten.

google/monitoring/metricsscope/v1/BUILD.bazel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ go_gapic_library(
123123
srcs = [":metricsscope_proto_with_info"],
124124
grpc_service_config = "metricsscopes_grpc_service_config.json",
125125
importpath = "cloud.google.com/go/monitoring/metricsscope/apiv1;metricsscope",
126-
service_yaml = "monitoring.yaml",
127126
metadata = True,
127+
service_yaml = "monitoring.yaml",
128128
deps = [
129129
":metricsscope_go_proto",
130130
"//google/longrunning:longrunning_go_proto",
131-
"@com_google_cloud_go//longrunning/autogen:go_default_library",
132131
"@com_google_cloud_go//longrunning:go_default_library",
132+
"@com_google_cloud_go//longrunning/autogen:go_default_library",
133133
],
134134
)
135135

@@ -145,8 +145,8 @@ go_gapic_assembly_pkg(
145145
name = "gapi-cloud-monitoring-metricsscope-v1-go",
146146
deps = [
147147
":metricsscope_go_gapic",
148-
":metricsscope_go_gapic_srcjar-test.srcjar",
149148
":metricsscope_go_gapic_srcjar-metadata.srcjar",
149+
":metricsscope_go_gapic_srcjar-test.srcjar",
150150
":metricsscope_go_proto",
151151
],
152152
)
@@ -250,8 +250,8 @@ nodejs_gapic_assembly_pkg(
250250
##############################################################################
251251
load(
252252
"@com_google_googleapis_imports//:imports.bzl",
253-
"ruby_gapic_assembly_pkg",
254253
"ruby_cloud_gapic_library",
254+
"ruby_gapic_assembly_pkg",
255255
"ruby_grpc_library",
256256
"ruby_proto_library",
257257
)
@@ -271,9 +271,9 @@ ruby_cloud_gapic_library(
271271
name = "metricsscope_ruby_gapic",
272272
srcs = [":metricsscope_proto_with_info"],
273273
extra_protoc_parameters = [
274-
"ruby-cloud-gem-name=google-cloud-monitoring-metrics_scope-v1",
275274
"ruby-cloud-api-id=monitoring.googleapis.com",
276275
"ruby-cloud-api-shortname=monitoring",
276+
"ruby-cloud-gem-name=google-cloud-monitoring-metrics_scope-v1",
277277
"ruby-cloud-product-url=https://cloud.google.com/monitoring",
278278
],
279279
grpc_service_config = "metricsscopes_grpc_service_config.json",

google/monitoring/v3/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ proto_library(
4949
"//google/api:metric_proto",
5050
"//google/api:monitored_resource_proto",
5151
"//google/api:resource_proto",
52+
"//google/longrunning:operations_proto",
5253
"//google/rpc:status_proto",
5354
"//google/type:calendar_period_proto",
5455
"@com_google_protobuf//:duration_proto",
@@ -153,6 +154,7 @@ go_proto_library(
153154
"//google/api:label_go_proto",
154155
"//google/api:metric_go_proto",
155156
"//google/api:monitoredres_go_proto",
157+
"//google/longrunning:longrunning_go_proto",
156158
"//google/rpc:status_go_proto",
157159
"//google/type:calendar_period_go_proto",
158160
],
@@ -169,7 +171,11 @@ go_gapic_library(
169171
":monitoring_go_proto",
170172
"//google/api:metric_go_proto",
171173
"//google/api:monitoredres_go_proto",
174+
"//google/longrunning:longrunning_go_proto",
175+
"@com_google_cloud_go//longrunning:go_default_library",
176+
"@com_google_cloud_go//longrunning/autogen:go_default_library",
172177
"@io_bazel_rules_go//proto/wkt:duration_go_proto",
178+
"@io_bazel_rules_go//proto/wkt:struct_go_proto",
173179
],
174180
)
175181

@@ -241,6 +247,7 @@ php_gapic_library(
241247
name = "monitoring_php_gapic",
242248
srcs = [":monitoring_proto_with_info"],
243249
grpc_service_config = "monitoring_grpc_service_config.json",
250+
service_yaml = "monitoring.yaml",
244251
deps = [
245252
":monitoring_php_grpc",
246253
":monitoring_php_proto",

google/monitoring/v3/alert.proto

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,30 @@ message AlertPolicy {
217217
Trigger trigger = 3;
218218
}
219219

220+
// A condition type that checks whether a log message in the [scoping
221+
// project](https://cloud.google.com/monitoring/api/v3#project_name)
222+
// satisfies the given filter. Logs from other projects in the metrics
223+
// scope are not evaluated.
224+
message LogMatch {
225+
// Required. A logs-based filter. See [Advanced Logs
226+
// Queries](/logging/docs/view/advanced-queries) for how this filter
227+
// should be constructed.
228+
string filter = 1 [(google.api.field_behavior) = REQUIRED];
229+
230+
// Optional. A map from a label key to an extractor expression, which is
231+
// used to extract the value for this label key. Each entry in this map is
232+
// a specification for how data should be extracted from log entries that
233+
// match `filter`. Each combination of extracted values is treated as a
234+
// separate rule for the purposes of triggering notifications. Label keys
235+
// and corresponding values can be used in notifications generated by this
236+
// condition.
237+
//
238+
// Please see [the documentation on logs-based metric
239+
// `valueExtractor`s](/logging/docs/reference/v2/rest/v2/projects.metrics#LogMetric.FIELDS.value_extractor)
240+
// for syntax and examples.
241+
map<string, string> label_extractors = 2;
242+
}
243+
220244
// A condition type that allows alert policies to be defined using
221245
// [Monitoring Query Language](https://cloud.google.com/monitoring/mql).
222246
message MonitoringQueryLanguageCondition {
@@ -286,12 +310,32 @@ message AlertPolicy {
286310
// receive new data points.
287311
MetricAbsence condition_absent = 2;
288312

313+
// A condition that checks for log messages matching given constraints. If
314+
// set, no other conditions can be present.
315+
LogMatch condition_matched_log = 20;
316+
289317
// A condition that uses the Monitoring Query Language to define
290318
// alerts.
291319
MonitoringQueryLanguageCondition condition_monitoring_query_language = 19;
292320
}
293321
}
294322

323+
// Control over how the notification channels in `notification_channels`
324+
// are notified when this alert fires.
325+
message AlertStrategy {
326+
// Control over the rate of notifications sent to this alert policy's
327+
// notification channels.
328+
message NotificationRateLimit {
329+
// Not more than one notification per `period`.
330+
google.protobuf.Duration period = 1;
331+
}
332+
333+
// Required for alert policies with a `LogMatch` condition.
334+
//
335+
// This limit is not implemented for alert policies that are not log-based.
336+
NotificationRateLimit notification_rate_limit = 1;
337+
}
338+
295339
// Operators for combining conditions.
296340
enum ConditionCombinerType {
297341
// An unspecified combiner.
@@ -319,7 +363,7 @@ message AlertPolicy {
319363
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
320364
//
321365
// `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy
322-
// is created. When calling the
366+
// is created. When calling the
323367
// [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy]
324368
// method, do not include the `name` field in the alerting policy passed as
325369
// part of the request.
@@ -391,4 +435,7 @@ message AlertPolicy {
391435
// A read-only record of the most recent change to the alerting policy. If
392436
// provided in a call to create or update, this field will be ignored.
393437
MutationRecord mutation_record = 11;
438+
439+
// Control over how this alert policy's notification channels are notified.
440+
AlertStrategy alert_strategy = 21;
394441
}

google/monitoring/v3/alert_service.proto

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ service AlertPolicyService {
9696

9797
// The protocol for the `CreateAlertPolicy` request.
9898
message CreateAlertPolicyRequest {
99-
// Required. The project in which to create the alerting policy. The format is:
99+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in
100+
// which to create the alerting policy. The format is:
100101
//
101102
// projects/[PROJECT_ID_OR_NUMBER]
102103
//
@@ -135,7 +136,8 @@ message GetAlertPolicyRequest {
135136

136137
// The protocol for the `ListAlertPolicies` request.
137138
message ListAlertPoliciesRequest {
138-
// Required. The project whose alert policies are to be listed. The format is:
139+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name)
140+
// whose alert policies are to be listed. The format is:
139141
//
140142
// projects/[PROJECT_ID_OR_NUMBER]
141143
//

google/monitoring/v3/common.proto

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ message TypedValue {
5151
}
5252
}
5353

54-
// A closed time interval. It extends from the start time to the end time, and includes both: `[startTime, endTime]`. Valid time intervals depend on the [`MetricKind`](/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricKind) of the metric value. The end time must not be earlier than the start time. When writing data points, the start time must not be more than 25 hours in the past and the end time must not be more than five minutes in the future.
54+
// A closed time interval. It extends from the start time to the end time, and includes both: `[startTime, endTime]`. Valid time intervals depend on the [`MetricKind`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricKind) of the metric value. The end time must not be earlier than the start time. When writing data points, the start time must not be more than 25 hours in the past and the end time must not be more than five minutes in the future.
5555
//
5656
// * For `GAUGE` metrics, the `startTime` value is technically optional; if
5757
// no value is specified, the start time defaults to the value of the
@@ -460,29 +460,3 @@ enum ComparisonType {
460460
// True if the left argument is not equal to the right argument.
461461
COMPARISON_NE = 6;
462462
}
463-
464-
// The tier of service for a Workspace. Please see the
465-
// [service tiers
466-
// documentation](https://cloud.google.com/monitoring/workspaces/tiers) for more
467-
// details.
468-
enum ServiceTier {
469-
option deprecated = true;
470-
471-
// An invalid sentinel value, used to indicate that a tier has not
472-
// been provided explicitly.
473-
SERVICE_TIER_UNSPECIFIED = 0;
474-
475-
// The Stackdriver Basic tier, a free tier of service that provides basic
476-
// features, a moderate allotment of logs, and access to built-in metrics.
477-
// A number of features are not available in this tier. For more details,
478-
// see [the service tiers
479-
// documentation](https://cloud.google.com/monitoring/workspaces/tiers).
480-
SERVICE_TIER_BASIC = 1;
481-
482-
// The Stackdriver Premium tier, a higher, more expensive tier of service
483-
// that provides access to all Stackdriver features, lets you use Stackdriver
484-
// with AWS accounts, and has a larger allotments for logs and metrics. For
485-
// more details, see [the service tiers
486-
// documentation](https://cloud.google.com/monitoring/workspaces/tiers).
487-
SERVICE_TIER_PREMIUM = 2;
488-
}

google/monitoring/v3/group_service.proto

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ service GroupService {
106106

107107
// The `ListGroup` request.
108108
message ListGroupsRequest {
109-
// Required. The project whose groups are to be listed. The format is:
109+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name)
110+
// whose groups are to be listed. The format is:
110111
//
111112
// projects/[PROJECT_ID_OR_NUMBER]
112113
string name = 7 [
@@ -189,7 +190,8 @@ message GetGroupRequest {
189190

190191
// The `CreateGroup` request.
191192
message CreateGroupRequest {
192-
// Required. The project in which to create the group. The format is:
193+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) in
194+
// which to create the group. The format is:
193195
//
194196
// projects/[PROJECT_ID_OR_NUMBER]
195197
string name = 4 [

google/monitoring/v3/metric.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ message TimeSeries {
5858
google.api.Metric metric = 1;
5959

6060
// The associated monitored resource. Custom metrics can use only certain
61-
// monitored resource types in their time series data.
61+
// monitored resource types in their time series data. For more information,
62+
// see [Monitored resources for custom
63+
// metrics](https://cloud.google.com/monitoring/custom-metrics/creating-metrics#custom-metric-resources).
6264
google.api.MonitoredResource resource = 2;
6365

6466
// Output only. The associated monitored resource metadata. When reading a

google/monitoring/v3/metric_service.proto

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ service MetricService {
156156

157157
// The `ListMonitoredResourceDescriptors` request.
158158
message ListMonitoredResourceDescriptorsRequest {
159-
// Required. The project on which to execute the request. The format is:
159+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
160+
// which to execute the request. The format is:
160161
//
161162
// projects/[PROJECT_ID_OR_NUMBER]
162163
string name = 5 [
@@ -213,7 +214,8 @@ message GetMonitoredResourceDescriptorRequest {
213214

214215
// The `ListMetricDescriptors` request.
215216
message ListMetricDescriptorsRequest {
216-
// Required. The project on which to execute the request. The format is:
217+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
218+
// which to execute the request. The format is:
217219
//
218220
// projects/[PROJECT_ID_OR_NUMBER]
219221
string name = 5 [
@@ -272,8 +274,9 @@ message GetMetricDescriptorRequest {
272274

273275
// The `CreateMetricDescriptor` request.
274276
message CreateMetricDescriptorRequest {
275-
// Required. The project on which to execute the request. The format is:
276-
//
277+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
278+
// which to execute the request. The format is:
279+
// 4
277280
// projects/[PROJECT_ID_OR_NUMBER]
278281
string name = 3 [
279282
(google.api.field_behavior) = REQUIRED,
@@ -316,8 +319,8 @@ message ListTimeSeriesRequest {
316319
HEADERS = 1;
317320
}
318321

319-
// Required. The project, organization or folder on which to execute the request. The
320-
// format is:
322+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name),
323+
// organization or folder on which to execute the request. The format is:
321324
//
322325
// projects/[PROJECT_ID_OR_NUMBER]
323326
// organizations/[ORGANIZATION_ID]
@@ -399,7 +402,8 @@ message ListTimeSeriesResponse {
399402

400403
// The `CreateTimeSeries` request.
401404
message CreateTimeSeriesRequest {
402-
// Required. The project on which to execute the request. The format is:
405+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
406+
// which to execute the request. The format is:
403407
//
404408
// projects/[PROJECT_ID_OR_NUMBER]
405409
string name = 3 [
@@ -451,15 +455,16 @@ message CreateTimeSeriesSummary {
451455

452456
// The `QueryTimeSeries` request.
453457
message QueryTimeSeriesRequest {
454-
// Required. The project on which to execute the request. The format is:
458+
// Required. The [project](https://cloud.google.com/monitoring/api/v3#project_name) on
459+
// which to execute the request. The format is:
455460
//
456461
// projects/[PROJECT_ID_OR_NUMBER]
457-
string name = 1;
462+
string name = 1 [(google.api.field_behavior) = REQUIRED];
458463

459464
// Required. The query in the [Monitoring Query
460465
// Language](https://cloud.google.com/monitoring/mql/reference) format.
461466
// The default time zone is in UTC.
462-
string query = 7;
467+
string query = 7 [(google.api.field_behavior) = REQUIRED];
463468

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

google/monitoring/v3/monitoring.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ documentation:
2323
individual method pages. The table entries below are presented in
2424
alphabetical order, not in order of common use. For explanations of the
2525
concepts found in the table entries, read the [Cloud Monitoring
26-
documentation](/monitoring/docs).
26+
documentation](https://cloud.google.com/monitoring/docs).
2727
2828
backend:
2929
rules:
@@ -46,6 +46,12 @@ backend:
4646

4747
authentication:
4848
rules:
49+
- selector: google.longrunning.Operations.GetOperation
50+
oauth:
51+
canonical_scopes: |-
52+
https://www.googleapis.com/auth/cloud-platform,
53+
https://www.googleapis.com/auth/monitoring,
54+
https://www.googleapis.com/auth/monitoring.read
4955
- selector: 'google.monitoring.v3.AlertPolicyService.*'
5056
oauth:
5157
canonical_scopes: |-

0 commit comments

Comments
 (0)