Skip to content

Commit 802c898

Browse files
yoshi-automationbusunkim96
authored andcommitted
feat(monitoring): add service monitoring (via synth) (#9799)
1 parent 407bb84 commit 802c898

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+6732
-253
lines changed

monitoring/docs/_static/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
div#python2-eol {
22
border-color: red;
33
border-width: medium;
4-
}
4+
}

monitoring/docs/_templates/layout.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
{% extends "!layout.html" %}
23
{%- block content %}
34
{%- if theme_fixed_sidebar|lower == 'true' %}

monitoring/docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
# Add any paths that contain custom static files (such as style sheets) here,
165165
# relative to this directory. They are copied after the builtin static files,
166166
# so a file named "default.css" will overwrite the builtin "default.css".
167-
html_static_path = ["_static"]
167+
# html_static_path = []
168168

169169
# Add any extra paths that contain custom files (such as robots.txt or
170170
# .htaccess) here, relative to this directory. These files are copied
@@ -264,7 +264,7 @@
264264
u"google-cloud-monitoring Documentation",
265265
author,
266266
"manual",
267-
)
267+
),
268268
]
269269

270270
# The name of an image file (relative to this directory) to place at the top of
@@ -320,7 +320,7 @@
320320
"google-cloud-monitoring",
321321
"GAPIC library for the {metadata.shortName} v3 service",
322322
"APIs",
323-
)
323+
),
324324
]
325325

326326
# Documents to append as an appendix to all manuals.

monitoring/google/cloud/monitoring.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from google.cloud.monitoring_v3 import GroupServiceClient
2222
from google.cloud.monitoring_v3 import MetricServiceClient
2323
from google.cloud.monitoring_v3 import NotificationChannelServiceClient
24+
from google.cloud.monitoring_v3 import ServiceMonitoringServiceClient
2425
from google.cloud.monitoring_v3 import UptimeCheckServiceClient
2526
from google.cloud.monitoring_v3 import enums
2627
from google.cloud.monitoring_v3 import types
@@ -33,5 +34,6 @@
3334
"GroupServiceClient",
3435
"MetricServiceClient",
3536
"NotificationChannelServiceClient",
37+
"ServiceMonitoringServiceClient",
3638
"UptimeCheckServiceClient",
3739
)

monitoring/google/cloud/monitoring_v3/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from google.cloud.monitoring_v3.gapic import (
2626
notification_channel_service_client as notification_client,
2727
)
28+
from google.cloud.monitoring_v3.gapic import service_monitoring_service_client
2829
from google.cloud.monitoring_v3.gapic import uptime_check_service_client
2930

3031

@@ -50,6 +51,13 @@ class NotificationChannelServiceClient(
5051
enums = enums
5152

5253

54+
class ServiceMonitoringServiceClient(
55+
service_monitoring_service_client.ServiceMonitoringServiceClient
56+
):
57+
__doc__ = service_monitoring_service_client.ServiceMonitoringServiceClient.__doc__
58+
enums = enums
59+
60+
5361
class UptimeCheckServiceClient(uptime_check_service_client.UptimeCheckServiceClient):
5462
__doc__ = uptime_check_service_client.UptimeCheckServiceClient.__doc__
5563
enums = enums
@@ -62,5 +70,6 @@ class UptimeCheckServiceClient(uptime_check_service_client.UptimeCheckServiceCli
6270
"GroupServiceClient",
6371
"MetricServiceClient",
6472
"NotificationChannelServiceClient",
73+
"ServiceMonitoringServiceClient",
6574
"UptimeCheckServiceClient",
6675
)

monitoring/google/cloud/monitoring_v3/gapic/alert_policy_service_client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545

4646
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
47-
"google-cloud-monitoring"
47+
"google-cloud-monitoring",
4848
).version
4949

5050

@@ -111,7 +111,7 @@ def alert_policy_condition_path(cls, project, alert_policy, condition):
111111
def project_path(cls, project):
112112
"""Return a fully-qualified project string."""
113113
return google.api_core.path_template.expand(
114-
"projects/{project}", project=project
114+
"projects/{project}", project=project,
115115
)
116116

117117
def __init__(
@@ -201,12 +201,12 @@ def __init__(
201201
self.transport = transport
202202
else:
203203
self.transport = alert_policy_service_grpc_transport.AlertPolicyServiceGrpcTransport(
204-
address=api_endpoint, channel=channel, credentials=credentials
204+
address=api_endpoint, channel=channel, credentials=credentials,
205205
)
206206

207207
if client_info is None:
208208
client_info = google.api_core.gapic_v1.client_info.ClientInfo(
209-
gapic_version=_GAPIC_LIBRARY_VERSION
209+
gapic_version=_GAPIC_LIBRARY_VERSION,
210210
)
211211
else:
212212
client_info.gapic_version = _GAPIC_LIBRARY_VERSION
@@ -217,7 +217,7 @@ def __init__(
217217
# (Ordinarily, these are the defaults specified in the `*_config.py`
218218
# file next to this one.)
219219
self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
220-
client_config["interfaces"][self._INTERFACE_NAME]
220+
client_config["interfaces"][self._INTERFACE_NAME],
221221
)
222222

223223
# Save a dictionary of cached API call functions.
@@ -322,7 +322,7 @@ def list_alert_policies(
322322
)
323323

324324
request = alert_service_pb2.ListAlertPoliciesRequest(
325-
name=name, filter=filter_, order_by=order_by, page_size=page_size
325+
name=name, filter=filter_, order_by=order_by, page_size=page_size,
326326
)
327327
if metadata is None:
328328
metadata = []
@@ -408,7 +408,7 @@ def get_alert_policy(
408408
client_info=self._client_info,
409409
)
410410

411-
request = alert_service_pb2.GetAlertPolicyRequest(name=name)
411+
request = alert_service_pb2.GetAlertPolicyRequest(name=name,)
412412
if metadata is None:
413413
metadata = []
414414
metadata = list(metadata)
@@ -498,7 +498,7 @@ def create_alert_policy(
498498
)
499499

500500
request = alert_service_pb2.CreateAlertPolicyRequest(
501-
name=name, alert_policy=alert_policy
501+
name=name, alert_policy=alert_policy,
502502
)
503503
if metadata is None:
504504
metadata = []
@@ -572,7 +572,7 @@ def delete_alert_policy(
572572
client_info=self._client_info,
573573
)
574574

575-
request = alert_service_pb2.DeleteAlertPolicyRequest(name=name)
575+
request = alert_service_pb2.DeleteAlertPolicyRequest(name=name,)
576576
if metadata is None:
577577
metadata = []
578578
metadata = list(metadata)
@@ -681,7 +681,7 @@ def update_alert_policy(
681681
)
682682

683683
request = alert_service_pb2.UpdateAlertPolicyRequest(
684-
alert_policy=alert_policy, update_mask=update_mask
684+
alert_policy=alert_policy, update_mask=update_mask,
685685
)
686686
if metadata is None:
687687
metadata = []

monitoring/google/cloud/monitoring_v3/gapic/alert_policy_service_client_config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@
1818
},
1919
"methods": {
2020
"ListAlertPolicies": {
21-
"timeout_millis": 30000,
21+
"timeout_millis": 60000,
2222
"retry_codes_name": "idempotent",
2323
"retry_params_name": "default",
2424
},
2525
"GetAlertPolicy": {
26-
"timeout_millis": 30000,
26+
"timeout_millis": 60000,
2727
"retry_codes_name": "idempotent",
2828
"retry_params_name": "default",
2929
},
3030
"CreateAlertPolicy": {
31-
"timeout_millis": 30000,
31+
"timeout_millis": 60000,
3232
"retry_codes_name": "non_idempotent",
3333
"retry_params_name": "default",
3434
},
3535
"DeleteAlertPolicy": {
36-
"timeout_millis": 30000,
36+
"timeout_millis": 60000,
3737
"retry_codes_name": "idempotent",
3838
"retry_params_name": "default",
3939
},
4040
"UpdateAlertPolicy": {
41-
"timeout_millis": 30000,
41+
"timeout_millis": 60000,
4242
"retry_codes_name": "non_idempotent",
4343
"retry_params_name": "default",
4444
},

monitoring/google/cloud/monitoring_v3/gapic/enums.py

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,37 @@
1919
import enum
2020

2121

22+
class CalendarPeriod(enum.IntEnum):
23+
"""
24+
A ``CalendarPeriod`` represents the abstract concept of a time period
25+
that has a canonical start. Grammatically, "the start of the current
26+
``CalendarPeriod``." All calendar times begin at midnight UTC.
27+
28+
Attributes:
29+
CALENDAR_PERIOD_UNSPECIFIED (int): Undefined period, raises an error.
30+
DAY (int): A day.
31+
WEEK (int): A week. Weeks begin on Monday, following `ISO
32+
8601 <https://en.wikipedia.org/wiki/ISO_week_date>`__.
33+
FORTNIGHT (int): A fortnight. The first calendar fortnight of the year begins at the
34+
start of week 1 according to `ISO
35+
8601 <https://en.wikipedia.org/wiki/ISO_week_date>`__.
36+
MONTH (int): A month.
37+
QUARTER (int): A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each
38+
year.
39+
HALF (int): A half-year. Half-years start on dates 1-Jan and 1-Jul.
40+
YEAR (int): A year.
41+
"""
42+
43+
CALENDAR_PERIOD_UNSPECIFIED = 0
44+
DAY = 1
45+
WEEK = 2
46+
FORTNIGHT = 3
47+
MONTH = 4
48+
QUARTER = 5
49+
HALF = 6
50+
YEAR = 7
51+
52+
2253
class ComparisonType(enum.IntEnum):
2354
"""
2455
Specifies an ordering relationship on two arguments, here called left and
@@ -525,6 +556,32 @@ class VerificationStatus(enum.IntEnum):
525556
VERIFIED = 2
526557

527558

559+
class ServiceLevelObjective(object):
560+
class View(enum.IntEnum):
561+
"""
562+
``ServiceLevelObjective.View`` determines what form of
563+
``ServiceLevelObjective`` is returned from ``GetServiceLevelObjective``,
564+
``ListServiceLevelObjectives``, and
565+
``ListServiceLevelObjectiveVersions`` RPCs.
566+
567+
Attributes:
568+
VIEW_UNSPECIFIED (int): Same as FULL.
569+
FULL (int): Return the embedded ``ServiceLevelIndicator`` in the form in which it
570+
was defined. If it was defined using a ``BasicSli``, return that
571+
``BasicSli``.
572+
EXPLICIT (int): For ``ServiceLevelIndicator``\ s using ``BasicSli`` articulation,
573+
instead return the ``ServiceLevelIndicator`` with its mode of
574+
computation fully spelled out as a ``RequestBasedSli``. For
575+
``ServiceLevelIndicator``\ s using ``RequestBasedSli`` or
576+
``WindowsBasedSli``, return the ``ServiceLevelIndicator`` as it was
577+
provided.
578+
"""
579+
580+
VIEW_UNSPECIFIED = 0
581+
FULL = 2
582+
EXPLICIT = 1
583+
584+
528585
class UptimeCheckConfig(object):
529586
class ContentMatcher(object):
530587
class ContentMatcherOption(enum.IntEnum):
@@ -535,17 +592,17 @@ class ContentMatcherOption(enum.IntEnum):
535592
CONTENT_MATCHER_OPTION_UNSPECIFIED (int): No content matcher type specified (maintained for backward
536593
compatibility, but deprecated for future use). Treated as
537594
``CONTAINS_STRING``.
538-
CONTAINS_STRING (int): Selects substring matching (there is a match if the output contains the
539-
``content`` string). This is the default value for checks without a
595+
CONTAINS_STRING (int): Selects substring matching. The match succeeds if the output contains
596+
the ``content`` string. This is the default value for checks without a
540597
``matcher`` option, or where the value of ``matcher`` is
541598
``CONTENT_MATCHER_OPTION_UNSPECIFIED``.
542-
NOT_CONTAINS_STRING (int): Selects negation of substring matching (there is a match if the output
543-
does NOT contain the ``content`` string).
544-
MATCHES_REGEX (int): Selects regular expression matching (there is a match of the output
545-
matches the regular expression specified in the ``content`` string).
546-
NOT_MATCHES_REGEX (int): Selects negation of regular expression matching (there is a match if the
547-
output does NOT match the regular expression specified in the
548-
``content`` string).
599+
NOT_CONTAINS_STRING (int): Selects negation of substring matching. The match succeeds if the output
600+
does *NOT* contain the ``content`` string.
601+
MATCHES_REGEX (int): Selects regular-expression matching. The match succeeds of the output
602+
matches the regular expression specified in the ``content`` string.
603+
NOT_MATCHES_REGEX (int): Selects negation of regular-expression matching. The match succeeds if
604+
the output does *NOT* match the regular expression specified in the
605+
``content`` string.
549606
"""
550607

551608
CONTENT_MATCHER_OPTION_UNSPECIFIED = 0

monitoring/google/cloud/monitoring_v3/gapic/group_service_client.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848

4949
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
50-
"google-cloud-monitoring"
50+
"google-cloud-monitoring",
5151
).version
5252

5353

@@ -97,14 +97,14 @@ def from_service_account_file(cls, filename, *args, **kwargs):
9797
def group_path(cls, project, group):
9898
"""Return a fully-qualified group string."""
9999
return google.api_core.path_template.expand(
100-
"projects/{project}/groups/{group}", project=project, group=group
100+
"projects/{project}/groups/{group}", project=project, group=group,
101101
)
102102

103103
@classmethod
104104
def project_path(cls, project):
105105
"""Return a fully-qualified project string."""
106106
return google.api_core.path_template.expand(
107-
"projects/{project}", project=project
107+
"projects/{project}", project=project,
108108
)
109109

110110
def __init__(
@@ -194,12 +194,12 @@ def __init__(
194194
self.transport = transport
195195
else:
196196
self.transport = group_service_grpc_transport.GroupServiceGrpcTransport(
197-
address=api_endpoint, channel=channel, credentials=credentials
197+
address=api_endpoint, channel=channel, credentials=credentials,
198198
)
199199

200200
if client_info is None:
201201
client_info = google.api_core.gapic_v1.client_info.ClientInfo(
202-
gapic_version=_GAPIC_LIBRARY_VERSION
202+
gapic_version=_GAPIC_LIBRARY_VERSION,
203203
)
204204
else:
205205
client_info.gapic_version = _GAPIC_LIBRARY_VERSION
@@ -210,7 +210,7 @@ def __init__(
210210
# (Ordinarily, these are the defaults specified in the `*_config.py`
211211
# file next to this one.)
212212
self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
213-
client_config["interfaces"][self._INTERFACE_NAME]
213+
client_config["interfaces"][self._INTERFACE_NAME],
214214
)
215215

216216
# Save a dictionary of cached API call functions.
@@ -409,7 +409,7 @@ def get_group(
409409
client_info=self._client_info,
410410
)
411411

412-
request = group_service_pb2.GetGroupRequest(name=name)
412+
request = group_service_pb2.GetGroupRequest(name=name,)
413413
if metadata is None:
414414
metadata = []
415415
metadata = list(metadata)
@@ -494,7 +494,7 @@ def create_group(
494494
)
495495

496496
request = group_service_pb2.CreateGroupRequest(
497-
name=name, group=group, validate_only=validate_only
497+
name=name, group=group, validate_only=validate_only,
498498
)
499499
if metadata is None:
500500
metadata = []
@@ -577,7 +577,7 @@ def update_group(
577577
)
578578

579579
request = group_service_pb2.UpdateGroupRequest(
580-
group=group, validate_only=validate_only
580+
group=group, validate_only=validate_only,
581581
)
582582
if metadata is None:
583583
metadata = []
@@ -652,7 +652,7 @@ def delete_group(
652652
client_info=self._client_info,
653653
)
654654

655-
request = group_service_pb2.DeleteGroupRequest(name=name, recursive=recursive)
655+
request = group_service_pb2.DeleteGroupRequest(name=name, recursive=recursive,)
656656
if metadata is None:
657657
metadata = []
658658
metadata = list(metadata)
@@ -766,7 +766,7 @@ def list_group_members(
766766
)
767767

768768
request = group_service_pb2.ListGroupMembersRequest(
769-
name=name, page_size=page_size, filter=filter_, interval=interval
769+
name=name, page_size=page_size, filter=filter_, interval=interval,
770770
)
771771
if metadata is None:
772772
metadata = []

0 commit comments

Comments
 (0)