Skip to content

Commit

Permalink
Regenerate client from commit 1358b465 of spec repo (#1699)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Oct 3, 2022
1 parent b52fe20 commit e394b67
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2022-09-30 11:29:12.247762",
"spec_repo_commit": "e6eb3136"
"regenerated": "2022-10-03 13:35:10.309058",
"spec_repo_commit": "1358b465"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2022-09-30 11:29:12.260285",
"spec_repo_commit": "e6eb3136"
"regenerated": "2022-10-03 13:35:10.323466",
"spec_repo_commit": "1358b465"
}
}
}
18 changes: 18 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6278,6 +6278,24 @@ components:
description: A Boolean indicating whether tagged users is notified on changes
to this monitor.
type: boolean
notify_by:
description: 'Controls what granularity a monitor alerts on. Only available
for multi-alerts.

For instance, a monitor grouped by `cluster`, `namespace`, `pod` can be
configured to only notify on each

new `cluster` violating the alert conditions by setting `notify_by` to
`["cluster"]`. Tags mentioned

in `notify_by` have to be a subset of the grouping tags in the query.

For example, a query grouped by `cluster`, `namespace` cannot notify on
`region`.'
items:
description: A grouping tag.
type: string
type: array
notify_no_data:
default: false
description: A Boolean indicating whether this monitor notifies when data
Expand Down
39 changes: 39 additions & 0 deletions api/datadogV1/model_monitor_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ type MonitorOptions struct {
NoDataTimeframe datadog.NullableInt64 `json:"no_data_timeframe,omitempty"`
// A Boolean indicating whether tagged users is notified on changes to this monitor.
NotifyAudit *bool `json:"notify_audit,omitempty"`
// Controls what granularity a monitor alerts on. Only available for multi-alerts.
// For instance, a monitor grouped by `cluster`, `namespace`, `pod` can be configured to only notify on each
// new `cluster` violating the alert conditions by setting `notify_by` to `["cluster"]`. Tags mentioned
// in `notify_by` have to be a subset of the grouping tags in the query.
// For example, a query grouped by `cluster`, `namespace` cannot notify on `region`.
NotifyBy []string `json:"notify_by,omitempty"`
// A Boolean indicating whether this monitor notifies when data stops reporting.
NotifyNoData *bool `json:"notify_no_data,omitempty"`
// Controls how groups or monitors are treated if an evaluation does not return any data points.
Expand Down Expand Up @@ -651,6 +657,34 @@ func (o *MonitorOptions) SetNotifyAudit(v bool) {
o.NotifyAudit = &v
}

// GetNotifyBy returns the NotifyBy field value if set, zero value otherwise.
func (o *MonitorOptions) GetNotifyBy() []string {
if o == nil || o.NotifyBy == nil {
var ret []string
return ret
}
return o.NotifyBy
}

// GetNotifyByOk returns a tuple with the NotifyBy field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *MonitorOptions) GetNotifyByOk() (*[]string, bool) {
if o == nil || o.NotifyBy == nil {
return nil, false
}
return &o.NotifyBy, true
}

// HasNotifyBy returns a boolean if a field has been set.
func (o *MonitorOptions) HasNotifyBy() bool {
return o != nil && o.NotifyBy != nil
}

// SetNotifyBy gets a reference to the given []string and assigns it to the NotifyBy field.
func (o *MonitorOptions) SetNotifyBy(v []string) {
o.NotifyBy = v
}

// GetNotifyNoData returns the NotifyNoData field value if set, zero value otherwise.
func (o *MonitorOptions) GetNotifyNoData() bool {
if o == nil || o.NotifyNoData == nil {
Expand Down Expand Up @@ -1089,6 +1123,9 @@ func (o MonitorOptions) MarshalJSON() ([]byte, error) {
if o.NotifyAudit != nil {
toSerialize["notify_audit"] = o.NotifyAudit
}
if o.NotifyBy != nil {
toSerialize["notify_by"] = o.NotifyBy
}
if o.NotifyNoData != nil {
toSerialize["notify_no_data"] = o.NotifyNoData
}
Expand Down Expand Up @@ -1151,6 +1188,7 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) {
NewHostDelay datadog.NullableInt64 `json:"new_host_delay,omitempty"`
NoDataTimeframe datadog.NullableInt64 `json:"no_data_timeframe,omitempty"`
NotifyAudit *bool `json:"notify_audit,omitempty"`
NotifyBy []string `json:"notify_by,omitempty"`
NotifyNoData *bool `json:"notify_no_data,omitempty"`
OnMissingData *OnMissingDataOption `json:"on_missing_data,omitempty"`
RenotifyInterval datadog.NullableInt64 `json:"renotify_interval,omitempty"`
Expand Down Expand Up @@ -1203,6 +1241,7 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) {
o.NewHostDelay = all.NewHostDelay
o.NoDataTimeframe = all.NoDataTimeframe
o.NotifyAudit = all.NotifyAudit
o.NotifyBy = all.NotifyBy
o.NotifyNoData = all.NotifyNoData
o.OnMissingData = all.OnMissingData
o.RenotifyInterval = all.RenotifyInterval
Expand Down
15 changes: 9 additions & 6 deletions examples/v1/monitors/ValidateMonitor_4247196452.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {
body := datadogV1.Monitor{
Name: datadog.PtrString("Example-Validate_a_multi_alert_monitor_returns_OK_response"),
Type: datadogV1.MONITORTYPE_LOG_ALERT,
Query: `logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2`,
Query: `logs("service:foo AND type:error").index("main").rollup("count").by("source,status").last("5m") > 2`,
Message: datadog.PtrString("some message Notify: @hipchat-channel"),
Tags: []string{
"test:examplevalidateamultialertmonitorreturnsokresponse",
Expand All @@ -34,11 +34,14 @@ func main() {
NewHostDelay: *datadog.NewNullableInt64(datadog.PtrInt64(600)),
NoDataTimeframe: *datadog.NewNullableInt64(nil),
NotifyAudit: datadog.PtrBool(false),
NotifyNoData: datadog.PtrBool(false),
OnMissingData: datadogV1.ONMISSINGDATAOPTION_SHOW_AND_NOTIFY_NO_DATA.Ptr(),
RenotifyInterval: *datadog.NewNullableInt64(datadog.PtrInt64(60)),
RequireFullWindow: datadog.PtrBool(true),
TimeoutH: *datadog.NewNullableInt64(datadog.PtrInt64(24)),
NotifyBy: []string{
"status",
},
NotifyNoData: datadog.PtrBool(false),
OnMissingData: datadogV1.ONMISSINGDATAOPTION_SHOW_AND_NOTIFY_NO_DATA.Ptr(),
RenotifyInterval: *datadog.NewNullableInt64(datadog.PtrInt64(60)),
RequireFullWindow: datadog.PtrBool(true),
TimeoutH: *datadog.NewNullableInt64(datadog.PtrInt64(24)),
Thresholds: &datadogV1.MonitorThresholds{
Critical: datadog.PtrFloat64(2),
Warning: *datadog.NewNullableFloat64(datadog.PtrFloat64(1)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-08-15T18:04:46.756Z
2022-09-30T16:41:33.797Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"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"}
{"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"}
form: {}
headers:
Accept:
Expand All @@ -11,7 +11,9 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/monitor/validate
response:
body: '{}'
body: '{}
'
code: 200
duration: ''
headers:
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/features/v1/monitors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Feature: Monitors
Scenario: Edit a monitor returns "Bad Request" response
Given new "UpdateMonitor" request
And request contains "monitor_id" parameter from "REPLACE.ME"
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"}
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"}
When the request is sent
Then the response status is 400 Bad Request

Expand Down
3 changes: 2 additions & 1 deletion tests/scenarios/features/v1/multi_alert_monitor_payload.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "{{ unique }}",
"type": "log alert",
"query": "logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") > 2",
"query": "logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source,status\").last(\"5m\") > 2",
"message": "some message Notify: @hipchat-channel",
"tags": ["test:{{ unique_lower_alnum }}", "env:ci"],
"priority": 3,
Expand All @@ -16,6 +16,7 @@
"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,
Expand Down

0 comments on commit e394b67

Please sign in to comment.