Class: Google::Apis::MonitoringV3::Criteria

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/monitoring_v3/classes.rb,
lib/google/apis/monitoring_v3/representations.rb,
lib/google/apis/monitoring_v3/representations.rb

Overview

Criteria specific to the AlertPolicys that this Snooze applies to. The Snooze will suppress alerts that come from one of the AlertPolicys whose names are supplied.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Criteria

Returns a new instance of Criteria.



1210
1211
1212
# File 'lib/google/apis/monitoring_v3/classes.rb', line 1210

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#filterString

Optional. When you define a snooze, you can also define a filter for that snooze. The filter is a string containing one or more key-value pairs. The string uses the standard https://google.aip.dev/160 filter syntax. If you define a filter for a snooze, then the snooze can only apply to one alert policy. When the snooze is active, incidents won't be created when the incident would have key-value pairs (labels) that match those specified by the filter in the snooze.Snooze filters support resource, metric, and metadata labels. If multiple labels are used, then they must be connected with an AND operator. For example, the following filter applies the snooze to incidents that have a resource label with an instance ID of 1234567890, a metric label with an instance name of test_group, a metadata user label with a key of foo and a value of bar, and a metadata system label with a key of region and a value of us-central1: "filter": "resource.labels.instance_id=\"1234567890\" AND metric.labels.instance_name=\"test_group\" AND metadata.user_labels.foo=\" bar\" AND metadata.system_labels.region=\"us-central1\"" Corresponds to the JSON property filter

Returns:

  • (String)


1199
1200
1201
# File 'lib/google/apis/monitoring_v3/classes.rb', line 1199

def filter
  @filter
end

#policiesArray<String>

The specific AlertPolicy names for the alert that should be snoozed. The format is: projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID] There is a limit of 16 policies per snooze. This limit is checked during snooze creation. Exactly 1 alert policy is required if filter is specified at the same time. Corresponds to the JSON property policies

Returns:

  • (Array<String>)


1208
1209
1210
# File 'lib/google/apis/monitoring_v3/classes.rb', line 1208

def policies
  @policies
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1215
1216
1217
1218
# File 'lib/google/apis/monitoring_v3/classes.rb', line 1215

def update!(**args)
  @filter = args[:filter] if args.key?(:filter)
  @policies = args[:policies] if args.key?(:policies)
end