Skip to content

Commit 3be8eb2

Browse files
feat: Added support for log-based alerts (#204)
See https://cloud.google.com/logging/docs/alerting/log-based-alerts for more information about logs-based alerts - [ ] Regenerate this pull request now. PiperOrigin-RevId: 393200011 Source-Link: googleapis/googleapis@354d076 Source-Link: googleapis/googleapis-gen@5791e7b feat: Added support for user-defined labels on cloud monitoring's Service object feat: Added support for user-defined labels on cloud monitoring's ServiceLevelObjective object fix: mark required fields in QueryTimeSeriesRequest as required by the backend
1 parent 3fdf904 commit 3be8eb2

36 files changed

Lines changed: 293 additions & 239 deletions

File tree

packages/google-cloud-monitoring/google/cloud/monitoring/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
from google.cloud.monitoring_v3.types.common import TimeInterval
6565
from google.cloud.monitoring_v3.types.common import TypedValue
6666
from google.cloud.monitoring_v3.types.common import ComparisonType
67-
from google.cloud.monitoring_v3.types.common import ServiceTier
6867
from google.cloud.monitoring_v3.types.dropped_labels import DroppedLabels
6968
from google.cloud.monitoring_v3.types.group import Group
7069
from google.cloud.monitoring_v3.types.group_service import CreateGroupRequest
@@ -236,7 +235,6 @@
236235
"TimeInterval",
237236
"TypedValue",
238237
"ComparisonType",
239-
"ServiceTier",
240238
"DroppedLabels",
241239
"Group",
242240
"CreateGroupRequest",

packages/google-cloud-monitoring/google/cloud/monitoring_v3/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
from .types.common import TimeInterval
4141
from .types.common import TypedValue
4242
from .types.common import ComparisonType
43-
from .types.common import ServiceTier
4443
from .types.dropped_labels import DroppedLabels
4544
from .types.group import Group
4645
from .types.group_service import CreateGroupRequest
@@ -216,7 +215,6 @@
216215
"ServiceLevelIndicator",
217216
"ServiceLevelObjective",
218217
"ServiceMonitoringServiceClient",
219-
"ServiceTier",
220218
"SpanContext",
221219
"TextLocator",
222220
"TimeInterval",

packages/google-cloud-monitoring/google/cloud/monitoring_v3/services/alert_policy_service/async_client.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,9 @@ async def list_alert_policies(
201201
The request object. The protocol for the
202202
`ListAlertPolicies` request.
203203
name (:class:`str`):
204-
Required. The project whose alert policies are to be
205-
listed. The format is:
204+
Required. The
205+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
206+
whose alert policies are to be listed. The format is:
206207
207208
::
208209
@@ -257,7 +258,6 @@ async def list_alert_policies(
257258
maximum=30.0,
258259
multiplier=1.3,
259260
predicate=retries.if_exception_type(
260-
core_exceptions.DeadlineExceeded,
261261
core_exceptions.ServiceUnavailable,
262262
),
263263
deadline=30.0,
@@ -351,7 +351,6 @@ async def get_alert_policy(
351351
maximum=30.0,
352352
multiplier=1.3,
353353
predicate=retries.if_exception_type(
354-
core_exceptions.DeadlineExceeded,
355354
core_exceptions.ServiceUnavailable,
356355
),
357356
deadline=30.0,
@@ -389,8 +388,9 @@ async def create_alert_policy(
389388
The request object. The protocol for the
390389
`CreateAlertPolicy` request.
391390
name (:class:`str`):
392-
Required. The project in which to create the alerting
393-
policy. The format is:
391+
Required. The
392+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
393+
in which to create the alerting policy. The format is:
394394
395395
::
396396
@@ -532,7 +532,6 @@ async def delete_alert_policy(
532532
maximum=30.0,
533533
multiplier=1.3,
534534
predicate=retries.if_exception_type(
535-
core_exceptions.DeadlineExceeded,
536535
core_exceptions.ServiceUnavailable,
537536
),
538537
deadline=30.0,

packages/google-cloud-monitoring/google/cloud/monitoring_v3/services/alert_policy_service/client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,9 @@ def list_alert_policies(
400400
The request object. The protocol for the
401401
`ListAlertPolicies` request.
402402
name (str):
403-
Required. The project whose alert policies are to be
404-
listed. The format is:
403+
Required. The
404+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
405+
whose alert policies are to be listed. The format is:
405406
406407
::
407408
@@ -568,8 +569,9 @@ def create_alert_policy(
568569
The request object. The protocol for the
569570
`CreateAlertPolicy` request.
570571
name (str):
571-
Required. The project in which to create the alerting
572-
policy. The format is:
572+
Required. The
573+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
574+
in which to create the alerting policy. The format is:
573575
574576
::
575577

packages/google-cloud-monitoring/google/cloud/monitoring_v3/services/alert_policy_service/transports/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def _prep_wrapped_messages(self, client_info):
167167
maximum=30.0,
168168
multiplier=1.3,
169169
predicate=retries.if_exception_type(
170-
core_exceptions.DeadlineExceeded,
171170
core_exceptions.ServiceUnavailable,
172171
),
173172
deadline=30.0,
@@ -182,7 +181,6 @@ def _prep_wrapped_messages(self, client_info):
182181
maximum=30.0,
183182
multiplier=1.3,
184183
predicate=retries.if_exception_type(
185-
core_exceptions.DeadlineExceeded,
186184
core_exceptions.ServiceUnavailable,
187185
),
188186
deadline=30.0,
@@ -200,7 +198,6 @@ def _prep_wrapped_messages(self, client_info):
200198
maximum=30.0,
201199
multiplier=1.3,
202200
predicate=retries.if_exception_type(
203-
core_exceptions.DeadlineExceeded,
204201
core_exceptions.ServiceUnavailable,
205202
),
206203
deadline=30.0,

packages/google-cloud-monitoring/google/cloud/monitoring_v3/services/group_service/async_client.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,9 @@ async def list_groups(
187187
request (:class:`google.cloud.monitoring_v3.types.ListGroupsRequest`):
188188
The request object. The `ListGroup` request.
189189
name (:class:`str`):
190-
Required. The project whose groups are to be listed. The
191-
format is:
190+
Required. The
191+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
192+
whose groups are to be listed. The format is:
192193
193194
::
194195
@@ -237,7 +238,6 @@ async def list_groups(
237238
maximum=30.0,
238239
multiplier=1.3,
239240
predicate=retries.if_exception_type(
240-
core_exceptions.DeadlineExceeded,
241241
core_exceptions.ServiceUnavailable,
242242
),
243243
deadline=30.0,
@@ -357,7 +357,6 @@ async def get_group(
357357
maximum=30.0,
358358
multiplier=1.3,
359359
predicate=retries.if_exception_type(
360-
core_exceptions.DeadlineExceeded,
361360
core_exceptions.ServiceUnavailable,
362361
),
363362
deadline=30.0,
@@ -394,8 +393,9 @@ async def create_group(
394393
request (:class:`google.cloud.monitoring_v3.types.CreateGroupRequest`):
395394
The request object. The `CreateGroup` request.
396395
name (:class:`str`):
397-
Required. The project in which to create the group. The
398-
format is:
396+
Required. The
397+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
398+
in which to create the group. The format is:
399399
400400
::
401401
@@ -585,12 +585,11 @@ async def update_group(
585585
maximum=30.0,
586586
multiplier=1.3,
587587
predicate=retries.if_exception_type(
588-
core_exceptions.DeadlineExceeded,
589588
core_exceptions.ServiceUnavailable,
590589
),
591-
deadline=30.0,
590+
deadline=180.0,
592591
),
593-
default_timeout=30.0,
592+
default_timeout=180.0,
594593
client_info=DEFAULT_CLIENT_INFO,
595594
)
596595

@@ -666,7 +665,6 @@ async def delete_group(
666665
maximum=30.0,
667666
multiplier=1.3,
668667
predicate=retries.if_exception_type(
669-
core_exceptions.DeadlineExceeded,
670668
core_exceptions.ServiceUnavailable,
671669
),
672670
deadline=30.0,
@@ -752,7 +750,6 @@ async def list_group_members(
752750
maximum=30.0,
753751
multiplier=1.3,
754752
predicate=retries.if_exception_type(
755-
core_exceptions.DeadlineExceeded,
756753
core_exceptions.ServiceUnavailable,
757754
),
758755
deadline=30.0,

packages/google-cloud-monitoring/google/cloud/monitoring_v3/services/group_service/client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,9 @@ def list_groups(
373373
request (google.cloud.monitoring_v3.types.ListGroupsRequest):
374374
The request object. The `ListGroup` request.
375375
name (str):
376-
Required. The project whose groups are to be listed. The
377-
format is:
376+
Required. The
377+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
378+
whose groups are to be listed. The format is:
378379
379380
::
380381
@@ -560,8 +561,9 @@ def create_group(
560561
request (google.cloud.monitoring_v3.types.CreateGroupRequest):
561562
The request object. The `CreateGroup` request.
562563
name (str):
563-
Required. The project in which to create the group. The
564-
format is:
564+
Required. The
565+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
566+
in which to create the group. The format is:
565567
566568
::
567569

packages/google-cloud-monitoring/google/cloud/monitoring_v3/services/group_service/transports/base.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ def _prep_wrapped_messages(self, client_info):
168168
maximum=30.0,
169169
multiplier=1.3,
170170
predicate=retries.if_exception_type(
171-
core_exceptions.DeadlineExceeded,
172171
core_exceptions.ServiceUnavailable,
173172
),
174173
deadline=30.0,
@@ -183,7 +182,6 @@ def _prep_wrapped_messages(self, client_info):
183182
maximum=30.0,
184183
multiplier=1.3,
185184
predicate=retries.if_exception_type(
186-
core_exceptions.DeadlineExceeded,
187185
core_exceptions.ServiceUnavailable,
188186
),
189187
deadline=30.0,
@@ -201,12 +199,11 @@ def _prep_wrapped_messages(self, client_info):
201199
maximum=30.0,
202200
multiplier=1.3,
203201
predicate=retries.if_exception_type(
204-
core_exceptions.DeadlineExceeded,
205202
core_exceptions.ServiceUnavailable,
206203
),
207-
deadline=30.0,
204+
deadline=180.0,
208205
),
209-
default_timeout=30.0,
206+
default_timeout=180.0,
210207
client_info=client_info,
211208
),
212209
self.delete_group: gapic_v1.method.wrap_method(
@@ -216,7 +213,6 @@ def _prep_wrapped_messages(self, client_info):
216213
maximum=30.0,
217214
multiplier=1.3,
218215
predicate=retries.if_exception_type(
219-
core_exceptions.DeadlineExceeded,
220216
core_exceptions.ServiceUnavailable,
221217
),
222218
deadline=30.0,
@@ -231,7 +227,6 @@ def _prep_wrapped_messages(self, client_info):
231227
maximum=30.0,
232228
multiplier=1.3,
233229
predicate=retries.if_exception_type(
234-
core_exceptions.DeadlineExceeded,
235230
core_exceptions.ServiceUnavailable,
236231
),
237232
deadline=30.0,

packages/google-cloud-monitoring/google/cloud/monitoring_v3/services/metric_service/async_client.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ async def list_monitored_resource_descriptors(
194194
The request object. The
195195
`ListMonitoredResourceDescriptors` request.
196196
name (:class:`str`):
197-
Required. The project on which to execute the request.
198-
The format is:
197+
Required. The
198+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
199+
on which to execute the request. The format is:
199200
200201
::
201202
@@ -244,7 +245,6 @@ async def list_monitored_resource_descriptors(
244245
maximum=30.0,
245246
multiplier=1.3,
246247
predicate=retries.if_exception_type(
247-
core_exceptions.DeadlineExceeded,
248248
core_exceptions.ServiceUnavailable,
249249
),
250250
deadline=30.0,
@@ -348,7 +348,6 @@ async def get_monitored_resource_descriptor(
348348
maximum=30.0,
349349
multiplier=1.3,
350350
predicate=retries.if_exception_type(
351-
core_exceptions.DeadlineExceeded,
352351
core_exceptions.ServiceUnavailable,
353352
),
354353
deadline=30.0,
@@ -385,8 +384,9 @@ async def list_metric_descriptors(
385384
request (:class:`google.cloud.monitoring_v3.types.ListMetricDescriptorsRequest`):
386385
The request object. The `ListMetricDescriptors` request.
387386
name (:class:`str`):
388-
Required. The project on which to execute the request.
389-
The format is:
387+
Required. The
388+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
389+
on which to execute the request. The format is:
390390
391391
::
392392
@@ -435,7 +435,6 @@ async def list_metric_descriptors(
435435
maximum=30.0,
436436
multiplier=1.3,
437437
predicate=retries.if_exception_type(
438-
core_exceptions.DeadlineExceeded,
439438
core_exceptions.ServiceUnavailable,
440439
),
441440
deadline=30.0,
@@ -532,7 +531,6 @@ async def get_metric_descriptor(
532531
maximum=30.0,
533532
multiplier=1.3,
534533
predicate=retries.if_exception_type(
535-
core_exceptions.DeadlineExceeded,
536534
core_exceptions.ServiceUnavailable,
537535
),
538536
deadline=30.0,
@@ -572,12 +570,10 @@ async def create_metric_descriptor(
572570
The request object. The `CreateMetricDescriptor`
573571
request.
574572
name (:class:`str`):
575-
Required. The project on which to execute the request.
576-
The format is:
577-
578-
::
579-
580-
projects/[PROJECT_ID_OR_NUMBER]
573+
Required. The
574+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
575+
on which to execute the request. The format is: 4
576+
projects/[PROJECT_ID_OR_NUMBER]
581577
582578
This corresponds to the ``name`` field
583579
on the ``request`` instance; if ``request`` is provided, this
@@ -707,7 +703,6 @@ async def delete_metric_descriptor(
707703
maximum=30.0,
708704
multiplier=1.3,
709705
predicate=retries.if_exception_type(
710-
core_exceptions.DeadlineExceeded,
711706
core_exceptions.ServiceUnavailable,
712707
),
713708
deadline=30.0,
@@ -746,8 +741,10 @@ async def list_time_series(
746741
request (:class:`google.cloud.monitoring_v3.types.ListTimeSeriesRequest`):
747742
The request object. The `ListTimeSeries` request.
748743
name (:class:`str`):
749-
Required. The project, organization or folder on which
750-
to execute the request. The format is:
744+
Required. The
745+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__,
746+
organization or folder on which to execute the request.
747+
The format is:
751748
752749
::
753750
@@ -837,12 +834,11 @@ async def list_time_series(
837834
maximum=30.0,
838835
multiplier=1.3,
839836
predicate=retries.if_exception_type(
840-
core_exceptions.DeadlineExceeded,
841837
core_exceptions.ServiceUnavailable,
842838
),
843-
deadline=30.0,
839+
deadline=90.0,
844840
),
845-
default_timeout=30.0,
841+
default_timeout=90.0,
846842
client_info=DEFAULT_CLIENT_INFO,
847843
)
848844

@@ -884,8 +880,9 @@ async def create_time_series(
884880
request (:class:`google.cloud.monitoring_v3.types.CreateTimeSeriesRequest`):
885881
The request object. The `CreateTimeSeries` request.
886882
name (:class:`str`):
887-
Required. The project on which to execute the request.
888-
The format is:
883+
Required. The
884+
`project <https://cloud.google.com/monitoring/api/v3#project_name>`__
885+
on which to execute the request. The format is:
889886
890887
::
891888

0 commit comments

Comments
 (0)