Skip to content

Commit e394b67

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 1358b465 of spec repo (#1699)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent b52fe20 commit e394b67

File tree

8 files changed

+78
-15
lines changed

8 files changed

+78
-15
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.4",
7-
"regenerated": "2022-09-30 11:29:12.247762",
8-
"spec_repo_commit": "e6eb3136"
7+
"regenerated": "2022-10-03 13:35:10.309058",
8+
"spec_repo_commit": "1358b465"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2022-09-30 11:29:12.260285",
13-
"spec_repo_commit": "e6eb3136"
12+
"regenerated": "2022-10-03 13:35:10.323466",
13+
"spec_repo_commit": "1358b465"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6278,6 +6278,24 @@ components:
62786278
description: A Boolean indicating whether tagged users is notified on changes
62796279
to this monitor.
62806280
type: boolean
6281+
notify_by:
6282+
description: 'Controls what granularity a monitor alerts on. Only available
6283+
for multi-alerts.
6284+
6285+
For instance, a monitor grouped by `cluster`, `namespace`, `pod` can be
6286+
configured to only notify on each
6287+
6288+
new `cluster` violating the alert conditions by setting `notify_by` to
6289+
`["cluster"]`. Tags mentioned
6290+
6291+
in `notify_by` have to be a subset of the grouping tags in the query.
6292+
6293+
For example, a query grouped by `cluster`, `namespace` cannot notify on
6294+
`region`.'
6295+
items:
6296+
description: A grouping tag.
6297+
type: string
6298+
type: array
62816299
notify_no_data:
62826300
default: false
62836301
description: A Boolean indicating whether this monitor notifies when data

api/datadogV1/model_monitor_options.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ type MonitorOptions struct {
6969
NoDataTimeframe datadog.NullableInt64 `json:"no_data_timeframe,omitempty"`
7070
// A Boolean indicating whether tagged users is notified on changes to this monitor.
7171
NotifyAudit *bool `json:"notify_audit,omitempty"`
72+
// Controls what granularity a monitor alerts on. Only available for multi-alerts.
73+
// For instance, a monitor grouped by `cluster`, `namespace`, `pod` can be configured to only notify on each
74+
// new `cluster` violating the alert conditions by setting `notify_by` to `["cluster"]`. Tags mentioned
75+
// in `notify_by` have to be a subset of the grouping tags in the query.
76+
// For example, a query grouped by `cluster`, `namespace` cannot notify on `region`.
77+
NotifyBy []string `json:"notify_by,omitempty"`
7278
// A Boolean indicating whether this monitor notifies when data stops reporting.
7379
NotifyNoData *bool `json:"notify_no_data,omitempty"`
7480
// Controls how groups or monitors are treated if an evaluation does not return any data points.
@@ -651,6 +657,34 @@ func (o *MonitorOptions) SetNotifyAudit(v bool) {
651657
o.NotifyAudit = &v
652658
}
653659

660+
// GetNotifyBy returns the NotifyBy field value if set, zero value otherwise.
661+
func (o *MonitorOptions) GetNotifyBy() []string {
662+
if o == nil || o.NotifyBy == nil {
663+
var ret []string
664+
return ret
665+
}
666+
return o.NotifyBy
667+
}
668+
669+
// GetNotifyByOk returns a tuple with the NotifyBy field value if set, nil otherwise
670+
// and a boolean to check if the value has been set.
671+
func (o *MonitorOptions) GetNotifyByOk() (*[]string, bool) {
672+
if o == nil || o.NotifyBy == nil {
673+
return nil, false
674+
}
675+
return &o.NotifyBy, true
676+
}
677+
678+
// HasNotifyBy returns a boolean if a field has been set.
679+
func (o *MonitorOptions) HasNotifyBy() bool {
680+
return o != nil && o.NotifyBy != nil
681+
}
682+
683+
// SetNotifyBy gets a reference to the given []string and assigns it to the NotifyBy field.
684+
func (o *MonitorOptions) SetNotifyBy(v []string) {
685+
o.NotifyBy = v
686+
}
687+
654688
// GetNotifyNoData returns the NotifyNoData field value if set, zero value otherwise.
655689
func (o *MonitorOptions) GetNotifyNoData() bool {
656690
if o == nil || o.NotifyNoData == nil {
@@ -1089,6 +1123,9 @@ func (o MonitorOptions) MarshalJSON() ([]byte, error) {
10891123
if o.NotifyAudit != nil {
10901124
toSerialize["notify_audit"] = o.NotifyAudit
10911125
}
1126+
if o.NotifyBy != nil {
1127+
toSerialize["notify_by"] = o.NotifyBy
1128+
}
10921129
if o.NotifyNoData != nil {
10931130
toSerialize["notify_no_data"] = o.NotifyNoData
10941131
}
@@ -1151,6 +1188,7 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) {
11511188
NewHostDelay datadog.NullableInt64 `json:"new_host_delay,omitempty"`
11521189
NoDataTimeframe datadog.NullableInt64 `json:"no_data_timeframe,omitempty"`
11531190
NotifyAudit *bool `json:"notify_audit,omitempty"`
1191+
NotifyBy []string `json:"notify_by,omitempty"`
11541192
NotifyNoData *bool `json:"notify_no_data,omitempty"`
11551193
OnMissingData *OnMissingDataOption `json:"on_missing_data,omitempty"`
11561194
RenotifyInterval datadog.NullableInt64 `json:"renotify_interval,omitempty"`
@@ -1203,6 +1241,7 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) {
12031241
o.NewHostDelay = all.NewHostDelay
12041242
o.NoDataTimeframe = all.NoDataTimeframe
12051243
o.NotifyAudit = all.NotifyAudit
1244+
o.NotifyBy = all.NotifyBy
12061245
o.NotifyNoData = all.NotifyNoData
12071246
o.OnMissingData = all.OnMissingData
12081247
o.RenotifyInterval = all.RenotifyInterval

examples/v1/monitors/ValidateMonitor_4247196452.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func main() {
1616
body := datadogV1.Monitor{
1717
Name: datadog.PtrString("Example-Validate_a_multi_alert_monitor_returns_OK_response"),
1818
Type: datadogV1.MONITORTYPE_LOG_ALERT,
19-
Query: `logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2`,
19+
Query: `logs("service:foo AND type:error").index("main").rollup("count").by("source,status").last("5m") > 2`,
2020
Message: datadog.PtrString("some message Notify: @hipchat-channel"),
2121
Tags: []string{
2222
"test:examplevalidateamultialertmonitorreturnsokresponse",
@@ -34,11 +34,14 @@ func main() {
3434
NewHostDelay: *datadog.NewNullableInt64(datadog.PtrInt64(600)),
3535
NoDataTimeframe: *datadog.NewNullableInt64(nil),
3636
NotifyAudit: datadog.PtrBool(false),
37-
NotifyNoData: datadog.PtrBool(false),
38-
OnMissingData: datadogV1.ONMISSINGDATAOPTION_SHOW_AND_NOTIFY_NO_DATA.Ptr(),
39-
RenotifyInterval: *datadog.NewNullableInt64(datadog.PtrInt64(60)),
40-
RequireFullWindow: datadog.PtrBool(true),
41-
TimeoutH: *datadog.NewNullableInt64(datadog.PtrInt64(24)),
37+
NotifyBy: []string{
38+
"status",
39+
},
40+
NotifyNoData: datadog.PtrBool(false),
41+
OnMissingData: datadogV1.ONMISSINGDATAOPTION_SHOW_AND_NOTIFY_NO_DATA.Ptr(),
42+
RenotifyInterval: *datadog.NewNullableInt64(datadog.PtrInt64(60)),
43+
RequireFullWindow: datadog.PtrBool(true),
44+
TimeoutH: *datadog.NewNullableInt64(datadog.PtrInt64(24)),
4245
Thresholds: &datadogV1.MonitorThresholds{
4346
Critical: datadog.PtrFloat64(2),
4447
Warning: *datadog.NewNullableFloat64(datadog.PtrFloat64(1)),
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-08-15T18:04:46.756Z
1+
2022-09-30T16:41:33.797Z

tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_a_multi-alert_monitor_returns_OK_response.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
33
body: |
4-
{"message":"some message Notify: @hipchat-channel","name":"Test-Validate_a_multi_alert_monitor_returns_OK_response-1660586686","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"group_retention_duration":"2d","groupby_simple_monitor":false,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"on_missing_data":"show_and_notify_no_data","renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":24},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") \u003e 2","tags":["test:testvalidateamultialertmonitorreturnsokresponse1660586686","env:ci"],"type":"log alert"}
4+
{"message":"some message Notify: @hipchat-channel","name":"Test-Validate_a_multi_alert_monitor_returns_OK_response-1664556093","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"group_retention_duration":"2d","groupby_simple_monitor":false,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_by":["status"],"notify_no_data":false,"on_missing_data":"show_and_notify_no_data","renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":24},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source,status\").last(\"5m\") \u003e 2","tags":["test:testvalidateamultialertmonitorreturnsokresponse1664556093","env:ci"],"type":"log alert"}
55
form: {}
66
headers:
77
Accept:
@@ -11,7 +11,9 @@ interactions:
1111
method: POST
1212
url: https://api.datadoghq.com/api/v1/monitor/validate
1313
response:
14-
body: '{}'
14+
body: '{}
15+
16+
'
1517
code: 200
1618
duration: ''
1719
headers:

tests/scenarios/features/v1/monitors.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Feature: Monitors
115115
Scenario: Edit a monitor returns "Bad Request" response
116116
Given new "UpdateMonitor" request
117117
And request contains "monitor_id" parameter from "REPLACE.ME"
118-
And body with value {"options": {"escalation_message": "none", "evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notify_audit": false, "notify_no_data": false, "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "restricted_roles": [], "tags": [], "type": "query alert"}
118+
And body with value {"options": {"escalation_message": "none", "evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notify_audit": false, "notify_by": [], "notify_no_data": false, "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "restricted_roles": [], "tags": [], "type": "query alert"}
119119
When the request is sent
120120
Then the response status is 400 Bad Request
121121

tests/scenarios/features/v1/multi_alert_monitor_payload.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "{{ unique }}",
33
"type": "log alert",
4-
"query": "logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") > 2",
4+
"query": "logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source,status\").last(\"5m\") > 2",
55
"message": "some message Notify: @hipchat-channel",
66
"tags": ["test:{{ unique_lower_alnum }}", "env:ci"],
77
"priority": 3,
@@ -16,6 +16,7 @@
1616
"new_host_delay": 600,
1717
"no_data_timeframe": null,
1818
"notify_audit": false,
19+
"notify_by": ["status"],
1920
"notify_no_data": false,
2021
"on_missing_data": "show_and_notify_no_data",
2122
"renotify_interval": 60,

0 commit comments

Comments
 (0)