Skip to content

Commit

Permalink
feat(monitoring): add service monitoring (via synth) (#9799)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and busunkim96 committed Nov 14, 2019
1 parent 407bb84 commit 802c898
Show file tree
Hide file tree
Showing 50 changed files with 6,732 additions and 253 deletions.
2 changes: 1 addition & 1 deletion monitoring/docs/_static/custom.css
@@ -1,4 +1,4 @@
div#python2-eol {
border-color: red;
border-width: medium;
}
}
1 change: 1 addition & 0 deletions monitoring/docs/_templates/layout.html
@@ -1,3 +1,4 @@

{% extends "!layout.html" %}
{%- block content %}
{%- if theme_fixed_sidebar|lower == 'true' %}
Expand Down
6 changes: 3 additions & 3 deletions monitoring/docs/conf.py
Expand Up @@ -164,7 +164,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# html_static_path = []

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down Expand Up @@ -264,7 +264,7 @@
u"google-cloud-monitoring Documentation",
author,
"manual",
)
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -320,7 +320,7 @@
"google-cloud-monitoring",
"GAPIC library for the {metadata.shortName} v3 service",
"APIs",
)
),
]

# Documents to append as an appendix to all manuals.
Expand Down
2 changes: 2 additions & 0 deletions monitoring/google/cloud/monitoring.py
Expand Up @@ -21,6 +21,7 @@
from google.cloud.monitoring_v3 import GroupServiceClient
from google.cloud.monitoring_v3 import MetricServiceClient
from google.cloud.monitoring_v3 import NotificationChannelServiceClient
from google.cloud.monitoring_v3 import ServiceMonitoringServiceClient
from google.cloud.monitoring_v3 import UptimeCheckServiceClient
from google.cloud.monitoring_v3 import enums
from google.cloud.monitoring_v3 import types
Expand All @@ -33,5 +34,6 @@
"GroupServiceClient",
"MetricServiceClient",
"NotificationChannelServiceClient",
"ServiceMonitoringServiceClient",
"UptimeCheckServiceClient",
)
9 changes: 9 additions & 0 deletions monitoring/google/cloud/monitoring_v3/__init__.py
Expand Up @@ -25,6 +25,7 @@
from google.cloud.monitoring_v3.gapic import (
notification_channel_service_client as notification_client,
)
from google.cloud.monitoring_v3.gapic import service_monitoring_service_client
from google.cloud.monitoring_v3.gapic import uptime_check_service_client


Expand All @@ -50,6 +51,13 @@ class NotificationChannelServiceClient(
enums = enums


class ServiceMonitoringServiceClient(
service_monitoring_service_client.ServiceMonitoringServiceClient
):
__doc__ = service_monitoring_service_client.ServiceMonitoringServiceClient.__doc__
enums = enums


class UptimeCheckServiceClient(uptime_check_service_client.UptimeCheckServiceClient):
__doc__ = uptime_check_service_client.UptimeCheckServiceClient.__doc__
enums = enums
Expand All @@ -62,5 +70,6 @@ class UptimeCheckServiceClient(uptime_check_service_client.UptimeCheckServiceCli
"GroupServiceClient",
"MetricServiceClient",
"NotificationChannelServiceClient",
"ServiceMonitoringServiceClient",
"UptimeCheckServiceClient",
)
Expand Up @@ -44,7 +44,7 @@


_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
"google-cloud-monitoring"
"google-cloud-monitoring",
).version


Expand Down Expand Up @@ -111,7 +111,7 @@ def alert_policy_condition_path(cls, project, alert_policy, condition):
def project_path(cls, project):
"""Return a fully-qualified project string."""
return google.api_core.path_template.expand(
"projects/{project}", project=project
"projects/{project}", project=project,
)

def __init__(
Expand Down Expand Up @@ -201,12 +201,12 @@ def __init__(
self.transport = transport
else:
self.transport = alert_policy_service_grpc_transport.AlertPolicyServiceGrpcTransport(
address=api_endpoint, channel=channel, credentials=credentials
address=api_endpoint, channel=channel, credentials=credentials,
)

if client_info is None:
client_info = google.api_core.gapic_v1.client_info.ClientInfo(
gapic_version=_GAPIC_LIBRARY_VERSION
gapic_version=_GAPIC_LIBRARY_VERSION,
)
else:
client_info.gapic_version = _GAPIC_LIBRARY_VERSION
Expand All @@ -217,7 +217,7 @@ def __init__(
# (Ordinarily, these are the defaults specified in the `*_config.py`
# file next to this one.)
self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
client_config["interfaces"][self._INTERFACE_NAME]
client_config["interfaces"][self._INTERFACE_NAME],
)

# Save a dictionary of cached API call functions.
Expand Down Expand Up @@ -322,7 +322,7 @@ def list_alert_policies(
)

request = alert_service_pb2.ListAlertPoliciesRequest(
name=name, filter=filter_, order_by=order_by, page_size=page_size
name=name, filter=filter_, order_by=order_by, page_size=page_size,
)
if metadata is None:
metadata = []
Expand Down Expand Up @@ -408,7 +408,7 @@ def get_alert_policy(
client_info=self._client_info,
)

request = alert_service_pb2.GetAlertPolicyRequest(name=name)
request = alert_service_pb2.GetAlertPolicyRequest(name=name,)
if metadata is None:
metadata = []
metadata = list(metadata)
Expand Down Expand Up @@ -498,7 +498,7 @@ def create_alert_policy(
)

request = alert_service_pb2.CreateAlertPolicyRequest(
name=name, alert_policy=alert_policy
name=name, alert_policy=alert_policy,
)
if metadata is None:
metadata = []
Expand Down Expand Up @@ -572,7 +572,7 @@ def delete_alert_policy(
client_info=self._client_info,
)

request = alert_service_pb2.DeleteAlertPolicyRequest(name=name)
request = alert_service_pb2.DeleteAlertPolicyRequest(name=name,)
if metadata is None:
metadata = []
metadata = list(metadata)
Expand Down Expand Up @@ -681,7 +681,7 @@ def update_alert_policy(
)

request = alert_service_pb2.UpdateAlertPolicyRequest(
alert_policy=alert_policy, update_mask=update_mask
alert_policy=alert_policy, update_mask=update_mask,
)
if metadata is None:
metadata = []
Expand Down
Expand Up @@ -18,27 +18,27 @@
},
"methods": {
"ListAlertPolicies": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
},
"GetAlertPolicy": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
},
"CreateAlertPolicy": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
},
"DeleteAlertPolicy": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
},
"UpdateAlertPolicy": {
"timeout_millis": 30000,
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
},
Expand Down
75 changes: 66 additions & 9 deletions monitoring/google/cloud/monitoring_v3/gapic/enums.py
Expand Up @@ -19,6 +19,37 @@
import enum


class CalendarPeriod(enum.IntEnum):
"""
A ``CalendarPeriod`` represents the abstract concept of a time period
that has a canonical start. Grammatically, "the start of the current
``CalendarPeriod``." All calendar times begin at midnight UTC.
Attributes:
CALENDAR_PERIOD_UNSPECIFIED (int): Undefined period, raises an error.
DAY (int): A day.
WEEK (int): A week. Weeks begin on Monday, following `ISO
8601 <https://en.wikipedia.org/wiki/ISO_week_date>`__.
FORTNIGHT (int): A fortnight. The first calendar fortnight of the year begins at the
start of week 1 according to `ISO
8601 <https://en.wikipedia.org/wiki/ISO_week_date>`__.
MONTH (int): A month.
QUARTER (int): A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each
year.
HALF (int): A half-year. Half-years start on dates 1-Jan and 1-Jul.
YEAR (int): A year.
"""

CALENDAR_PERIOD_UNSPECIFIED = 0
DAY = 1
WEEK = 2
FORTNIGHT = 3
MONTH = 4
QUARTER = 5
HALF = 6
YEAR = 7


class ComparisonType(enum.IntEnum):
"""
Specifies an ordering relationship on two arguments, here called left and
Expand Down Expand Up @@ -525,6 +556,32 @@ class VerificationStatus(enum.IntEnum):
VERIFIED = 2


class ServiceLevelObjective(object):
class View(enum.IntEnum):
"""
``ServiceLevelObjective.View`` determines what form of
``ServiceLevelObjective`` is returned from ``GetServiceLevelObjective``,
``ListServiceLevelObjectives``, and
``ListServiceLevelObjectiveVersions`` RPCs.
Attributes:
VIEW_UNSPECIFIED (int): Same as FULL.
FULL (int): Return the embedded ``ServiceLevelIndicator`` in the form in which it
was defined. If it was defined using a ``BasicSli``, return that
``BasicSli``.
EXPLICIT (int): For ``ServiceLevelIndicator``\ s using ``BasicSli`` articulation,
instead return the ``ServiceLevelIndicator`` with its mode of
computation fully spelled out as a ``RequestBasedSli``. For
``ServiceLevelIndicator``\ s using ``RequestBasedSli`` or
``WindowsBasedSli``, return the ``ServiceLevelIndicator`` as it was
provided.
"""

VIEW_UNSPECIFIED = 0
FULL = 2
EXPLICIT = 1


class UptimeCheckConfig(object):
class ContentMatcher(object):
class ContentMatcherOption(enum.IntEnum):
Expand All @@ -535,17 +592,17 @@ class ContentMatcherOption(enum.IntEnum):
CONTENT_MATCHER_OPTION_UNSPECIFIED (int): No content matcher type specified (maintained for backward
compatibility, but deprecated for future use). Treated as
``CONTAINS_STRING``.
CONTAINS_STRING (int): Selects substring matching (there is a match if the output contains the
``content`` string). This is the default value for checks without a
CONTAINS_STRING (int): Selects substring matching. The match succeeds if the output contains
the ``content`` string. This is the default value for checks without a
``matcher`` option, or where the value of ``matcher`` is
``CONTENT_MATCHER_OPTION_UNSPECIFIED``.
NOT_CONTAINS_STRING (int): Selects negation of substring matching (there is a match if the output
does NOT contain the ``content`` string).
MATCHES_REGEX (int): Selects regular expression matching (there is a match of the output
matches the regular expression specified in the ``content`` string).
NOT_MATCHES_REGEX (int): Selects negation of regular expression matching (there is a match if the
output does NOT match the regular expression specified in the
``content`` string).
NOT_CONTAINS_STRING (int): Selects negation of substring matching. The match succeeds if the output
does *NOT* contain the ``content`` string.
MATCHES_REGEX (int): Selects regular-expression matching. The match succeeds of the output
matches the regular expression specified in the ``content`` string.
NOT_MATCHES_REGEX (int): Selects negation of regular-expression matching. The match succeeds if
the output does *NOT* match the regular expression specified in the
``content`` string.
"""

CONTENT_MATCHER_OPTION_UNSPECIFIED = 0
Expand Down
22 changes: 11 additions & 11 deletions monitoring/google/cloud/monitoring_v3/gapic/group_service_client.py
Expand Up @@ -47,7 +47,7 @@


_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
"google-cloud-monitoring"
"google-cloud-monitoring",
).version


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

@classmethod
def project_path(cls, project):
"""Return a fully-qualified project string."""
return google.api_core.path_template.expand(
"projects/{project}", project=project
"projects/{project}", project=project,
)

def __init__(
Expand Down Expand Up @@ -194,12 +194,12 @@ def __init__(
self.transport = transport
else:
self.transport = group_service_grpc_transport.GroupServiceGrpcTransport(
address=api_endpoint, channel=channel, credentials=credentials
address=api_endpoint, channel=channel, credentials=credentials,
)

if client_info is None:
client_info = google.api_core.gapic_v1.client_info.ClientInfo(
gapic_version=_GAPIC_LIBRARY_VERSION
gapic_version=_GAPIC_LIBRARY_VERSION,
)
else:
client_info.gapic_version = _GAPIC_LIBRARY_VERSION
Expand All @@ -210,7 +210,7 @@ def __init__(
# (Ordinarily, these are the defaults specified in the `*_config.py`
# file next to this one.)
self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
client_config["interfaces"][self._INTERFACE_NAME]
client_config["interfaces"][self._INTERFACE_NAME],
)

# Save a dictionary of cached API call functions.
Expand Down Expand Up @@ -409,7 +409,7 @@ def get_group(
client_info=self._client_info,
)

request = group_service_pb2.GetGroupRequest(name=name)
request = group_service_pb2.GetGroupRequest(name=name,)
if metadata is None:
metadata = []
metadata = list(metadata)
Expand Down Expand Up @@ -494,7 +494,7 @@ def create_group(
)

request = group_service_pb2.CreateGroupRequest(
name=name, group=group, validate_only=validate_only
name=name, group=group, validate_only=validate_only,
)
if metadata is None:
metadata = []
Expand Down Expand Up @@ -577,7 +577,7 @@ def update_group(
)

request = group_service_pb2.UpdateGroupRequest(
group=group, validate_only=validate_only
group=group, validate_only=validate_only,
)
if metadata is None:
metadata = []
Expand Down Expand Up @@ -652,7 +652,7 @@ def delete_group(
client_info=self._client_info,
)

request = group_service_pb2.DeleteGroupRequest(name=name, recursive=recursive)
request = group_service_pb2.DeleteGroupRequest(name=name, recursive=recursive,)
if metadata is None:
metadata = []
metadata = list(metadata)
Expand Down Expand Up @@ -766,7 +766,7 @@ def list_group_members(
)

request = group_service_pb2.ListGroupMembersRequest(
name=name, page_size=page_size, filter=filter_, interval=interval
name=name, page_size=page_size, filter=filter_, interval=interval,
)
if metadata is None:
metadata = []
Expand Down

0 comments on commit 802c898

Please sign in to comment.