Skip to content

Commit

Permalink
feat: [google-cloud-monitoring] Added support for notification prompt…
Browse files Browse the repository at this point in the history
…s in AlertPolicy (#13325)

BEGIN_COMMIT_OVERRIDE
feat: Added support for notification prompts in AlertPolicy
feat: Added support for PromQL metric validation opt-out in AlertPolicy
END_COMMIT_OVERRIDE


- [ ] Regenerate this pull request now.

fix: Fix typing issue with gRPC metadata when key ends in -bin
chore: Update gapic-generator-python to v1.21.0

PiperOrigin-RevId: 705285820

Source-Link:
googleapis/googleapis@f9b8b91

Source-Link:
googleapis/googleapis-gen@ca1e0a1
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1vbml0b3JpbmcvLk93bEJvdC55YW1sIiwiaCI6ImNhMWUwYTFlNDcyZDZlNmY1ZGU4ODNhNWNiNTQ3MjRmMTEyY2UzNDgifQ==

BEGIN_NESTED_COMMIT
feat: [google-cloud-monitoring] Added support for notification prompts
in AlertPolicy
feat: Added support for PromQL metric validation opt-out in AlertPolicy

PiperOrigin-RevId: 702547115

Source-Link:
googleapis/googleapis@dedba31

Source-Link:
googleapis/googleapis-gen@8413119
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1vbml0b3JpbmcvLk93bEJvdC55YW1sIiwiaCI6Ijg0MTMxMTk2NzY0YzhiNGY3ZTI0ZDVlNmY0NTAwYmEyYzFjOTM4YTQifQ==
END_NESTED_COMMIT

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <omairnaveed@ymail.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
4 people authored Dec 12, 2024
1 parent 19ed3be commit d596268
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.23.1" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.23.1" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ async def sample_get_alert_policy():
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. For an overview
of alert policies, see [Introduction to
of alerting policies, see [Introduction to
Alerting](\ https://cloud.google.com/monitoring/alerts/).
"""
Expand Down Expand Up @@ -611,7 +611,7 @@ async def sample_create_alert_policy():
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. For an overview
of alert policies, see [Introduction to
of alerting policies, see [Introduction to
Alerting](\ https://cloud.google.com/monitoring/alerts/).
"""
Expand Down Expand Up @@ -868,7 +868,7 @@ async def sample_update_alert_policy():
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. For an overview
of alert policies, see [Introduction to
of alerting policies, see [Introduction to
Alerting](\ https://cloud.google.com/monitoring/alerts/).
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ def sample_get_alert_policy():
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. For an overview
of alert policies, see [Introduction to
of alerting policies, see [Introduction to
Alerting](\ https://cloud.google.com/monitoring/alerts/).
"""
Expand Down Expand Up @@ -1004,7 +1004,7 @@ def sample_create_alert_policy():
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. For an overview
of alert policies, see [Introduction to
of alerting policies, see [Introduction to
Alerting](\ https://cloud.google.com/monitoring/alerts/).
"""
Expand Down Expand Up @@ -1255,7 +1255,7 @@ def sample_update_alert_policy():
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. For an overview
of alert policies, see [Introduction to
of alerting policies, see [Introduction to
Alerting](\ https://cloud.google.com/monitoring/alerts/).
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ async def sample_update_notification_channel():
request (Optional[Union[google.cloud.monitoring_v3.types.UpdateNotificationChannelRequest, dict]]):
The request object. The ``UpdateNotificationChannel`` request.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
The fields to update.
Optional. The fields to update.
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand Down Expand Up @@ -1149,10 +1149,9 @@ async def sample_delete_notification_channel():
will be deleted regardless of its use in
alert policies (the policies will be
updated to remove the channel). If
false, channels that are still
referenced by an existing alerting
policy will fail to be deleted in a
delete operation.
false, this operation will fail if the
notification channel is referenced by
existing alerting policies.
This corresponds to the ``force`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ def sample_update_notification_channel():
request (Union[google.cloud.monitoring_v3.types.UpdateNotificationChannelRequest, dict]):
The request object. The ``UpdateNotificationChannel`` request.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
The fields to update.
Optional. The fields to update.
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand Down Expand Up @@ -1533,10 +1533,9 @@ def sample_delete_notification_channel():
will be deleted regardless of its use in
alert policies (the policies will be
updated to remove the channel). If
false, channels that are still
referenced by an existing alerting
policy will fail to be deleted in a
delete operation.
false, this operation will fail if the
notification channel is referenced by
existing alerting policies.
This corresponds to the ``force`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ async def sample_create_snooze():
# Initialize request argument(s)
snooze = monitoring_v3.Snooze()
snooze.name = "name_value"
snooze.display_name = "display_name_value"
request = monitoring_v3.CreateSnoozeRequest(
Expand Down Expand Up @@ -671,7 +670,6 @@ async def sample_update_snooze():
# Initialize request argument(s)
snooze = monitoring_v3.Snooze()
snooze.name = "name_value"
snooze.display_name = "display_name_value"
request = monitoring_v3.UpdateSnoozeRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ def sample_create_snooze():
# Initialize request argument(s)
snooze = monitoring_v3.Snooze()
snooze.name = "name_value"
snooze.display_name = "display_name_value"
request = monitoring_v3.CreateSnoozeRequest(
Expand Down Expand Up @@ -1059,7 +1058,6 @@ def sample_update_snooze():
# Initialize request argument(s)
snooze = monitoring_v3.Snooze()
snooze.name = "name_value"
snooze.display_name = "display_name_value"
request = monitoring_v3.UpdateSnoozeRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
class AlertPolicy(proto.Message):
r"""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. For an overview of alert policies, see
`Introduction to
or services about this state. For an overview of alerting policies,
see `Introduction to
Alerting <https://cloud.google.com/monitoring/alerts/>`__.
Attributes:
name (str):
Required if the policy exists. The resource name for this
policy. The format is:
Identifier. Required if the policy exists. The resource name
for this policy. The format is:
::
Expand Down Expand Up @@ -118,10 +118,10 @@ class AlertPolicy(proto.Message):
unless a field projection has been specified
that strips it out.
validity (google.rpc.status_pb2.Status):
Read-only description of how the alert policy
is invalid. This field is only set when the
alert policy is invalid. An invalid alert policy
will not generate incidents.
Read-only description of how the alerting
policy is invalid. This field is only set when
the alerting policy is invalid. An invalid
alerting policy will not generate incidents.
notification_channels (MutableSequence[str]):
Identifies the notification channels to which notifications
should be sent when incidents are opened or closed or when
Expand All @@ -146,10 +146,10 @@ class AlertPolicy(proto.Message):
to the alerting policy. If provided in a call to
create or update, this field will be ignored.
alert_strategy (google.cloud.monitoring_v3.types.AlertPolicy.AlertStrategy):
Control over how this alert policy's
Control over how this alerting policy's
notification channels are notified.
severity (google.cloud.monitoring_v3.types.AlertPolicy.Severity):
Optional. The severity of an alert policy
Optional. The severity of an alerting policy
indicates how important incidents generated by
that policy are. The severity level will be
displayed on the Incident detail page and in
Expand Down Expand Up @@ -183,8 +183,8 @@ class ConditionCombinerType(proto.Enum):
AND_WITH_MATCHING_RESOURCE = 3

class Severity(proto.Enum):
r"""An enumeration of possible severity level for an Alert
Policy.
r"""An enumeration of possible severity level for an alerting
policy.
Values:
SEVERITY_UNSPECIFIED (0):
Expand Down Expand Up @@ -220,7 +220,7 @@ class Documentation(proto.Message):
characters and may not exceed more than 10,240 bytes when
encoded in UTF-8 format, whichever is smaller. This text can
be `templatized by using
variables <https://cloud.google.com/monitoring/alerts/doc-variables>`__.
variables <https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars>`__.
mime_type (str):
The format of the ``content`` field. Presently, only the
value ``"text/markdown"`` is supported. See
Expand All @@ -240,7 +240,7 @@ class Documentation(proto.Message):
The contents of the subject line can be `templatized by
using
variables <https://cloud.google.com/monitoring/alerts/doc-variables>`__.
variables <https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars>`__.
If this field is missing or empty, a default subject line
will be generated.
links (MutableSequence[google.cloud.monitoring_v3.types.AlertPolicy.Documentation.Link]):
Expand Down Expand Up @@ -712,7 +712,7 @@ class LogMatch(proto.Message):
)

class MonitoringQueryLanguageCondition(proto.Message):
r"""A condition type that allows alert policies to be defined using
r"""A condition type that allows alerting policies to be defined using
`Monitoring Query
Language <https://cloud.google.com/monitoring/mql>`__.
Expand Down Expand Up @@ -770,7 +770,7 @@ class MonitoringQueryLanguageCondition(proto.Message):
)

class PrometheusQueryLanguageCondition(proto.Message):
r"""A condition type that allows alert policies to be defined using
r"""A condition type that allows alerting policies to be defined using
`Prometheus Query Language
(PromQL) <https://prometheus.io/docs/prometheus/latest/querying/basics/>`__.
Expand Down Expand Up @@ -831,7 +831,7 @@ class PrometheusQueryLanguageCondition(proto.Message):
result. Label names `must be
valid <https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels>`__.
Label values can be `templatized by using
variables <https://cloud.google.com/monitoring/alerts/doc-variables>`__.
variables <https://cloud.google.com/monitoring/alerts/doc-variables#doc-vars>`__.
The only available variable names are the names of the
labels in the PromQL result, including "**name**" and
"value". "labels" may be empty.
Expand Down Expand Up @@ -942,21 +942,41 @@ class AlertStrategy(proto.Message):
Attributes:
notification_rate_limit (google.cloud.monitoring_v3.types.AlertPolicy.AlertStrategy.NotificationRateLimit):
Required for alert policies with a ``LogMatch`` condition.
This limit is not implemented for alert policies that are
not log-based.
Required for log-based alerting policies, i.e. policies with
a ``LogMatch`` condition.
This limit is not implemented for alerting policies that do
not have a LogMatch condition.
notification_prompts (MutableSequence[google.cloud.monitoring_v3.types.AlertPolicy.AlertStrategy.NotificationPrompt]):
For log-based alert policies, the notification prompts is
always [OPENED]. For non log-based alert policies, the
notification prompts can be [OPENED] or [OPENED, CLOSED].
auto_close (google.protobuf.duration_pb2.Duration):
If an alert policy that was active has no
If an alerting policy that was active has no
data for this long, any open incidents will
close
notification_channel_strategy (MutableSequence[google.cloud.monitoring_v3.types.AlertPolicy.AlertStrategy.NotificationChannelStrategy]):
Control how notifications will be sent out,
on a per-channel basis.
"""

class NotificationPrompt(proto.Enum):
r"""Control when notifications will be sent out.
Values:
NOTIFICATION_PROMPT_UNSPECIFIED (0):
No strategy specified. Treated as error.
OPENED (1):
Notify when an incident is opened.
CLOSED (3):
Notify when an incident is closed.
"""
NOTIFICATION_PROMPT_UNSPECIFIED = 0
OPENED = 1
CLOSED = 3

class NotificationRateLimit(proto.Message):
r"""Control over the rate of notifications sent to this alert
r"""Control over the rate of notifications sent to this alerting
policy's notification channels.
Attributes:
Expand Down Expand Up @@ -1008,6 +1028,13 @@ class NotificationChannelStrategy(proto.Message):
message="AlertPolicy.AlertStrategy.NotificationRateLimit",
)
)
notification_prompts: MutableSequence[
"AlertPolicy.AlertStrategy.NotificationPrompt"
] = proto.RepeatedField(
proto.ENUM,
number=2,
enum="AlertPolicy.AlertStrategy.NotificationPrompt",
)
auto_close: duration_pb2.Duration = proto.Field(
proto.MESSAGE,
number=3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,28 @@ class ListAlertPoliciesRequest(proto.Message):
[GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy]
operation, instead.
filter (str):
If provided, this field specifies the criteria that must be
met by alert policies to be included in the response.
Optional. If provided, this field specifies the criteria
that must be met by alert policies to be included in the
response.
For more details, see `sorting and
filtering <https://cloud.google.com/monitoring/api/v3/sorting-and-filtering>`__.
order_by (str):
A comma-separated list of fields by which to sort the
result. Supports the same set of field references as the
Optional. A comma-separated list of fields by which to sort
the result. Supports the same set of field references as the
``filter`` field. Entries can be prefixed with a minus sign
to sort by the field in descending order.
For more details, see `sorting and
filtering <https://cloud.google.com/monitoring/api/v3/sorting-and-filtering>`__.
page_size (int):
The maximum number of results to return in a
single response.
Optional. The maximum number of results to
return in a single response.
page_token (str):
If this field is not empty then it must contain the
``nextPageToken`` value returned by a previous call to this
method. Using this field causes the method to return more
results from the previous method call.
Optional. If this field is not empty then it must contain
the ``nextPageToken`` value returned by a previous call to
this method. Using this field causes the method to return
more results from the previous method call.
"""

name: str = proto.Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ class NotificationChannel(proto.Message):
[NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type]
field.
name (str):
The full REST resource name for this channel. The format is:
Identifier. The full REST resource name for this channel.
The format is:
::
Expand Down
Loading

0 comments on commit d596268

Please sign in to comment.