From 71e94c234d500515ed22cc7df031ea0d45153084 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 5 Aug 2022 20:20:13 -0400 Subject: [PATCH] feat: Added support for evaluating missing data in AlertPolicy (#470) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Added support for evaluating missing data in AlertPolicy PiperOrigin-RevId: 465650583 Source-Link: https://github.com/googleapis/googleapis/commit/9f7c0ffdaa8ceb2f27982bad713a03306157a4d2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/5b7443170272800dbde8d6cd89af75f60e860d97 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWI3NDQzMTcwMjcyODAwZGJkZThkNmNkODlhZjc1ZjYwZTg2MGQ5NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../alert_policy_service/async_client.py | 20 ++++---- .../services/alert_policy_service/client.py | 20 ++++---- .../alert_policy_service/transports/grpc.py | 12 ++--- .../transports/grpc_asyncio.py | 12 ++--- google/cloud/monitoring_v3/types/alert.py | 48 +++++++++++++++---- .../monitoring_v3/types/alert_service.py | 2 +- 6 files changed, 72 insertions(+), 42 deletions(-) diff --git a/google/cloud/monitoring_v3/services/alert_policy_service/async_client.py b/google/cloud/monitoring_v3/services/alert_policy_service/async_client.py index 6a3ce16e..3411e98a 100644 --- a/google/cloud/monitoring_v3/services/alert_policy_service/async_client.py +++ b/google/cloud/monitoring_v3/services/alert_policy_service/async_client.py @@ -45,14 +45,14 @@ class AlertPolicyServiceAsyncClient: """The AlertPolicyService API is used to manage (list, create, delete, - edit) alert policies in Stackdriver Monitoring. An alerting policy - is a description of the conditions under which some aspect of your - system is considered to be "unhealthy" and the ways to notify people - or services about this state. In addition to using this API, alert - policies can also be managed through `Stackdriver + edit) alert policies in Cloud Monitoring. An alerting policy is a + description of the conditions under which some aspect of your system + is considered to be "unhealthy" and the ways to notify people or + services about this state. In addition to using this API, alert + policies can also be managed through `Cloud Monitoring `__, which can be reached by clicking the "Monitoring" tab in `Cloud - Console `__. + console `__. """ _client: AlertPolicyServiceClient @@ -511,10 +511,10 @@ async def sample_create_alert_policy(): Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. \|name\| must be a host project of a - workspace, otherwise INVALID_ARGUMENT error will return. - The alerting policy that is returned will have a name - that contains a normalized representation of this name - as a prefix but adds a suffix of the form + Metrics Scope, otherwise INVALID_ARGUMENT error will + return. The alerting policy that is returned will have a + name that contains a normalized representation of this + name as a prefix but adds a suffix of the form ``/alertPolicies/[ALERT_POLICY_ID]``, identifying the policy in the container. diff --git a/google/cloud/monitoring_v3/services/alert_policy_service/client.py b/google/cloud/monitoring_v3/services/alert_policy_service/client.py index a9495812..9e9a1f1b 100644 --- a/google/cloud/monitoring_v3/services/alert_policy_service/client.py +++ b/google/cloud/monitoring_v3/services/alert_policy_service/client.py @@ -84,14 +84,14 @@ def get_transport_class( class AlertPolicyServiceClient(metaclass=AlertPolicyServiceClientMeta): """The AlertPolicyService API is used to manage (list, create, delete, - edit) alert policies in Stackdriver Monitoring. An alerting policy - is a description of the conditions under which some aspect of your - system is considered to be "unhealthy" and the ways to notify people - or services about this state. In addition to using this API, alert - policies can also be managed through `Stackdriver + edit) alert policies in Cloud Monitoring. An alerting policy is a + description of the conditions under which some aspect of your system + is considered to be "unhealthy" and the ways to notify people or + services about this state. In addition to using this API, alert + policies can also be managed through `Cloud Monitoring `__, which can be reached by clicking the "Monitoring" tab in `Cloud - Console `__. + console `__. """ @staticmethod @@ -728,10 +728,10 @@ def sample_create_alert_policy(): Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. \|name\| must be a host project of a - workspace, otherwise INVALID_ARGUMENT error will return. - The alerting policy that is returned will have a name - that contains a normalized representation of this name - as a prefix but adds a suffix of the form + Metrics Scope, otherwise INVALID_ARGUMENT error will + return. The alerting policy that is returned will have a + name that contains a normalized representation of this + name as a prefix but adds a suffix of the form ``/alertPolicies/[ALERT_POLICY_ID]``, identifying the policy in the container. diff --git a/google/cloud/monitoring_v3/services/alert_policy_service/transports/grpc.py b/google/cloud/monitoring_v3/services/alert_policy_service/transports/grpc.py index 2b6b4da8..2e0b3ec1 100644 --- a/google/cloud/monitoring_v3/services/alert_policy_service/transports/grpc.py +++ b/google/cloud/monitoring_v3/services/alert_policy_service/transports/grpc.py @@ -34,14 +34,14 @@ class AlertPolicyServiceGrpcTransport(AlertPolicyServiceTransport): """gRPC backend transport for AlertPolicyService. The AlertPolicyService API is used to manage (list, create, delete, - edit) alert policies in Stackdriver Monitoring. An alerting policy - is a description of the conditions under which some aspect of your - system is considered to be "unhealthy" and the ways to notify people - or services about this state. In addition to using this API, alert - policies can also be managed through `Stackdriver + edit) alert policies in Cloud Monitoring. An alerting policy is a + description of the conditions under which some aspect of your system + is considered to be "unhealthy" and the ways to notify people or + services about this state. In addition to using this API, alert + policies can also be managed through `Cloud Monitoring `__, which can be reached by clicking the "Monitoring" tab in `Cloud - Console `__. + console `__. This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation diff --git a/google/cloud/monitoring_v3/services/alert_policy_service/transports/grpc_asyncio.py b/google/cloud/monitoring_v3/services/alert_policy_service/transports/grpc_asyncio.py index 510a8924..547b645b 100644 --- a/google/cloud/monitoring_v3/services/alert_policy_service/transports/grpc_asyncio.py +++ b/google/cloud/monitoring_v3/services/alert_policy_service/transports/grpc_asyncio.py @@ -35,14 +35,14 @@ class AlertPolicyServiceGrpcAsyncIOTransport(AlertPolicyServiceTransport): """gRPC AsyncIO backend transport for AlertPolicyService. The AlertPolicyService API is used to manage (list, create, delete, - edit) alert policies in Stackdriver Monitoring. An alerting policy - is a description of the conditions under which some aspect of your - system is considered to be "unhealthy" and the ways to notify people - or services about this state. In addition to using this API, alert - policies can also be managed through `Stackdriver + edit) alert policies in Cloud Monitoring. An alerting policy is a + description of the conditions under which some aspect of your system + is considered to be "unhealthy" and the ways to notify people or + services about this state. In addition to using this API, alert + policies can also be managed through `Cloud Monitoring `__, which can be reached by clicking the "Monitoring" tab in `Cloud - Console `__. + console `__. This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation diff --git a/google/cloud/monitoring_v3/types/alert.py b/google/cloud/monitoring_v3/types/alert.py index 047052d8..ec0e04cf 100644 --- a/google/cloud/monitoring_v3/types/alert.py +++ b/google/cloud/monitoring_v3/types/alert.py @@ -46,8 +46,8 @@ class AlertPolicy(proto.Message): projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] - ``[ALERT_POLICY_ID]`` is assigned by Stackdriver Monitoring - when the policy is created. When calling the + ``[ALERT_POLICY_ID]`` is assigned by Cloud Monitoring when + the policy is created. When calling the [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] method, do not include the ``name`` field in the alerting policy passed as part of the request. @@ -146,7 +146,9 @@ class Documentation(proto.Message): The text of the documentation, interpreted according to ``mime_type``. The content may not exceed 8,192 Unicode characters and may not exceed more than 10,240 bytes when - encoded in UTF-8 format, whichever is smaller. + encoded in UTF-8 format, whichever is smaller. This text can + be `templatized by using + variables `__. mime_type (str): The format of the ``content`` field. Presently, only the value ``"text/markdown"`` is supported. See @@ -184,16 +186,16 @@ class Condition(proto.Message): projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID] - ``[CONDITION_ID]`` is assigned by Stackdriver Monitoring - when the condition is created as part of a new or updated - alerting policy. + ``[CONDITION_ID]`` is assigned by Cloud Monitoring when the + condition is created as part of a new or updated alerting + policy. When calling the [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] method, do not include the ``name`` field in the conditions - of the requested alerting policy. Stackdriver Monitoring - creates the condition identifiers and includes them in the - new policy. + of the requested alerting policy. Cloud Monitoring creates + the condition identifiers and includes them in the new + policy. When calling the [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy] @@ -235,6 +237,16 @@ class Condition(proto.Message): This field is a member of `oneof`_ ``condition``. """ + class EvaluationMissingData(proto.Enum): + r"""A condition control that determines how metric-threshold + conditions are evaluated when data stops arriving. + This control doesn't affect metric-absence policies. + """ + EVALUATION_MISSING_DATA_UNSPECIFIED = 0 + EVALUATION_MISSING_DATA_INACTIVE = 1 + EVALUATION_MISSING_DATA_ACTIVE = 2 + EVALUATION_MISSING_DATA_NO_OP = 3 + class Trigger(proto.Message): r"""Specifies how many time series must fail a predicate to trigger a condition. If not specified, then a ``{count: 1}`` trigger is used. @@ -360,6 +372,10 @@ class MetricThreshold(proto.Message): identified by ``filter`` and ``aggregations``, or by the ratio, if ``denominator_filter`` and ``denominator_aggregations`` are specified. + evaluation_missing_data (google.cloud.monitoring_v3.types.AlertPolicy.Condition.EvaluationMissingData): + A condition control that determines how + metric-threshold conditions are evaluated when + data stops arriving. """ filter = proto.Field( @@ -399,6 +415,11 @@ class MetricThreshold(proto.Message): number=7, message="AlertPolicy.Condition.Trigger", ) + evaluation_missing_data = proto.Field( + proto.ENUM, + number=11, + enum="AlertPolicy.Condition.EvaluationMissingData", + ) class MetricAbsence(proto.Message): r"""A condition type that checks that monitored resources are reporting @@ -536,6 +557,10 @@ class MonitoringQueryLanguageCondition(proto.Message): identified by ``filter`` and ``aggregations``, or by the ratio, if ``denominator_filter`` and ``denominator_aggregations`` are specified. + evaluation_missing_data (google.cloud.monitoring_v3.types.AlertPolicy.Condition.EvaluationMissingData): + A condition control that determines how + metric-threshold conditions are evaluated when + data stops arriving. """ query = proto.Field( @@ -552,6 +577,11 @@ class MonitoringQueryLanguageCondition(proto.Message): number=3, message="AlertPolicy.Condition.Trigger", ) + evaluation_missing_data = proto.Field( + proto.ENUM, + number=4, + enum="AlertPolicy.Condition.EvaluationMissingData", + ) name = proto.Field( proto.STRING, diff --git a/google/cloud/monitoring_v3/types/alert_service.py b/google/cloud/monitoring_v3/types/alert_service.py index 76f814da..7cb0b0a3 100644 --- a/google/cloud/monitoring_v3/types/alert_service.py +++ b/google/cloud/monitoring_v3/types/alert_service.py @@ -47,7 +47,7 @@ class CreateAlertPolicyRequest(proto.Message): Note that this field names the parent container in which the alerting policy will be written, not the name of the created - policy. \|name\| must be a host project of a workspace, + policy. \|name\| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds