Skip to content

Commit 8d49888

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 57b75ade of spec repo
1 parent d68eec9 commit 8d49888

File tree

37 files changed

+353
-129
lines changed

37 files changed

+353
-129
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.2",
7-
"regenerated": "2022-08-17 14:32:08.800124",
8-
"spec_repo_commit": "a957cd49"
7+
"regenerated": "2022-08-17 17:26:27.093787",
8+
"spec_repo_commit": "57b75ade"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.2",
12-
"regenerated": "2022-08-17 14:32:08.814442",
13-
"spec_repo_commit": "a957cd49"
12+
"regenerated": "2022-08-17 17:26:27.106221",
13+
"spec_repo_commit": "57b75ade"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6133,6 +6133,17 @@ components:
61336133
format: int64
61346134
nullable: true
61356135
type: integer
6136+
group_retention_duration:
6137+
description: 'The time span after which groups with missing data are dropped
6138+
from the monitor state.
6139+
6140+
The minimum value is one hour, and the maximum value is 72 hours.
6141+
6142+
Example values are: "60m", "1h", and "2d".
6143+
6144+
This option is only available for APM Trace Analytics, Audit Trail, CI,
6145+
Error Tracking, Event, Logs, and RUM monitors.'
6146+
type: string
61366147
groupby_simple_monitor:
61376148
description: Whether the log alert monitor triggers a single alert or multiple
61386149
alerts when any group breaches a threshold.
@@ -6223,6 +6234,8 @@ components:
62236234
description: A Boolean indicating whether this monitor notifies when data
62246235
stops reporting.
62256236
type: boolean
6237+
on_missing_data:
6238+
$ref: '#/components/schemas/OnMissingDataOption'
62266239
renotify_interval:
62276240
default: null
62286241
description: "The number of minutes after the last notification before a
@@ -7928,6 +7941,32 @@ components:
79287941
format: int64
79297942
type: integer
79307943
type: object
7944+
OnMissingDataOption:
7945+
description: 'Controls how groups or monitors are treated if an evaluation does
7946+
not return any data points.
7947+
7948+
The default option results in different behavior depending on the monitor
7949+
query type.
7950+
7951+
For monitors using Count queries, an empty monitor evaluation is treated as
7952+
0 and is compared to the threshold conditions.
7953+
7954+
For monitor using any query type other than Count, for example Gauge or Rate,
7955+
the monitor shows the last known status.
7956+
7957+
This option is only available for APM Trace Analytics, Audit Trail, CI, Error
7958+
Tracking, Event, Logs, and RUM monitors.'
7959+
enum:
7960+
- default
7961+
- show_no_data
7962+
- show_and_notify_no_data
7963+
- resolve
7964+
type: string
7965+
x-enum-varnames:
7966+
- DEFAULT
7967+
- SHOW_NO_DATA
7968+
- SHOW_AND_NOTIFY_NO_DATA
7969+
- RESOLVE
79317970
OrgDowngradedResponse:
79327971
description: Status of downgrade
79337972
properties:

docs/datadog_api_client.v1.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,6 +2353,13 @@ notebooks\_response\_page
23532353
:members:
23542354
:show-inheritance:
23552355

2356+
on\_missing\_data\_option
2357+
-------------------------
2358+
2359+
.. automodule:: datadog_api_client.v1.model.on_missing_data_option
2360+
:members:
2361+
:show-inheritance:
2362+
23562363
org\_downgraded\_response
23572364
-------------------------
23582365

examples/v1/monitors/ValidateExistingMonitor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from datadog_api_client.v1.model.monitor_options import MonitorOptions
1010
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
1111
from datadog_api_client.v1.model.monitor_type import MonitorType
12+
from datadog_api_client.v1.model.on_missing_data_option import OnMissingDataOption
1213

1314
# there is a valid "monitor" in the system
1415
MONITOR_ID = environ["MONITOR_ID"]
@@ -34,6 +35,7 @@
3435
no_data_timeframe=None,
3536
notify_audit=False,
3637
notify_no_data=False,
38+
on_missing_data=OnMissingDataOption("show_and_notify_no_data"),
3739
renotify_interval=60,
3840
require_full_window=True,
3941
timeout_h=24,

examples/v1/monitors/ValidateMonitor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from datadog_api_client.v1.model.monitor_options import MonitorOptions
99
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
1010
from datadog_api_client.v1.model.monitor_type import MonitorType
11+
from datadog_api_client.v1.model.on_missing_data_option import OnMissingDataOption
1112

1213
body = Monitor(
1314
name="Example-Validate_a_monitor_returns_OK_response",
@@ -30,6 +31,7 @@
3031
no_data_timeframe=None,
3132
notify_audit=False,
3233
notify_no_data=False,
34+
on_missing_data=OnMissingDataOption("show_and_notify_no_data"),
3335
renotify_interval=60,
3436
require_full_window=True,
3537
timeout_h=24,
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
Validate a multi-alert monitor returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v1.api.monitors_api import MonitorsApi
7+
from datadog_api_client.v1.model.monitor import Monitor
8+
from datadog_api_client.v1.model.monitor_options import MonitorOptions
9+
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
10+
from datadog_api_client.v1.model.monitor_type import MonitorType
11+
from datadog_api_client.v1.model.on_missing_data_option import OnMissingDataOption
12+
13+
body = Monitor(
14+
name="Example-Validate_a_multi_alert_monitor_returns_OK_response",
15+
type=MonitorType("log alert"),
16+
query='logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2',
17+
message="some message Notify: @hipchat-channel",
18+
tags=[
19+
"test:examplevalidateamultialertmonitorreturnsokresponse",
20+
"env:ci",
21+
],
22+
priority=3,
23+
options=MonitorOptions(
24+
enable_logs_sample=True,
25+
escalation_message="the situation has escalated",
26+
evaluation_delay=700,
27+
group_retention_duration="2d",
28+
groupby_simple_monitor=False,
29+
include_tags=True,
30+
locked=False,
31+
new_host_delay=600,
32+
no_data_timeframe=None,
33+
notify_audit=False,
34+
notify_no_data=False,
35+
on_missing_data=OnMissingDataOption("show_and_notify_no_data"),
36+
renotify_interval=60,
37+
require_full_window=True,
38+
timeout_h=24,
39+
thresholds=MonitorThresholds(
40+
critical=2.0,
41+
warning=1.0,
42+
),
43+
),
44+
)
45+
46+
configuration = Configuration()
47+
with ApiClient(configuration) as api_client:
48+
api_instance = MonitorsApi(api_client)
49+
response = api_instance.validate_monitor(body=body)
50+
51+
print(response)

src/datadog_api_client/v1/model/monitor_options.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class MonitorOptions(ModelNormal):
2222
def openapi_types(_):
2323
from datadog_api_client.v1.model.monitor_options_aggregation import MonitorOptionsAggregation
2424
from datadog_api_client.v1.model.monitor_device_id import MonitorDeviceID
25+
from datadog_api_client.v1.model.on_missing_data_option import OnMissingDataOption
2526
from datadog_api_client.v1.model.monitor_renotify_status_type import MonitorRenotifyStatusType
2627
from datadog_api_client.v1.model.monitor_threshold_window_options import MonitorThresholdWindowOptions
2728
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
@@ -35,6 +36,7 @@ def openapi_types(_):
3536
"enable_logs_sample": (bool,),
3637
"escalation_message": (str,),
3738
"evaluation_delay": (int, none_type),
39+
"group_retention_duration": (str,),
3840
"groupby_simple_monitor": (bool,),
3941
"include_tags": (bool,),
4042
"locked": (bool,),
@@ -45,6 +47,7 @@ def openapi_types(_):
4547
"no_data_timeframe": (int, none_type),
4648
"notify_audit": (bool,),
4749
"notify_no_data": (bool,),
50+
"on_missing_data": (OnMissingDataOption,),
4851
"renotify_interval": (int, none_type),
4952
"renotify_occurrences": (int, none_type),
5053
"renotify_statuses": ([MonitorRenotifyStatusType], none_type),
@@ -70,6 +73,7 @@ def openapi_types(_):
7073
"enable_logs_sample": "enable_logs_sample",
7174
"escalation_message": "escalation_message",
7275
"evaluation_delay": "evaluation_delay",
76+
"group_retention_duration": "group_retention_duration",
7377
"groupby_simple_monitor": "groupby_simple_monitor",
7478
"include_tags": "include_tags",
7579
"locked": "locked",
@@ -80,6 +84,7 @@ def openapi_types(_):
8084
"no_data_timeframe": "no_data_timeframe",
8185
"notify_audit": "notify_audit",
8286
"notify_no_data": "notify_no_data",
87+
"on_missing_data": "on_missing_data",
8388
"renotify_interval": "renotify_interval",
8489
"renotify_occurrences": "renotify_occurrences",
8590
"renotify_statuses": "renotify_statuses",
@@ -120,6 +125,12 @@ def __init__(self, *args, **kwargs):
120125
This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.
121126
:type evaluation_delay: int, none_type, optional
122127
128+
:param group_retention_duration: The time span after which groups with missing data are dropped from the monitor state.
129+
The minimum value is one hour, and the maximum value is 72 hours.
130+
Example values are: "60m", "1h", and "2d".
131+
This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors.
132+
:type group_retention_duration: str, optional
133+
123134
:param groupby_simple_monitor: Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.
124135
:type groupby_simple_monitor: bool, optional
125136
@@ -168,6 +179,13 @@ def __init__(self, *args, **kwargs):
168179
:param notify_no_data: A Boolean indicating whether this monitor notifies when data stops reporting.
169180
:type notify_no_data: bool, optional
170181
182+
:param on_missing_data: Controls how groups or monitors are treated if an evaluation does not return any data points.
183+
The default option results in different behavior depending on the monitor query type.
184+
For monitors using Count queries, an empty monitor evaluation is treated as 0 and is compared to the threshold conditions.
185+
For monitor using any query type other than Count, for example Gauge or Rate, the monitor shows the last known status.
186+
This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors.
187+
:type on_missing_data: OnMissingDataOption, optional
188+
171189
:param renotify_interval: The number of minutes after the last notification before a monitor re-notifies on the current status.
172190
It only re-notifies if it’s not resolved.
173191
:type renotify_interval: int, none_type, optional
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
5+
6+
from datadog_api_client.model_utils import (
7+
ModelSimple,
8+
cached_property,
9+
)
10+
11+
12+
class OnMissingDataOption(ModelSimple):
13+
"""
14+
Controls how groups or monitors are treated if an evaluation does not return any data points.
15+
The default option results in different behavior depending on the monitor query type.
16+
For monitors using Count queries, an empty monitor evaluation is treated as 0 and is compared to the threshold conditions.
17+
For monitor using any query type other than Count, for example Gauge or Rate, the monitor shows the last known status.
18+
This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors.
19+
20+
:param value: Must be one of ["default", "show_no_data", "show_and_notify_no_data", "resolve"].
21+
:type value: str
22+
"""
23+
24+
allowed_values = {
25+
"value": {
26+
"DEFAULT": "default",
27+
"SHOW_NO_DATA": "show_no_data",
28+
"SHOW_AND_NOTIFY_NO_DATA": "show_and_notify_no_data",
29+
"RESOLVE": "resolve",
30+
},
31+
}
32+
33+
@cached_property
34+
def openapi_types(_):
35+
return {
36+
"value": (str,),
37+
}

src/datadog_api_client/v1/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@
382382
from datadog_api_client.v1.model.notebooks_response_data_attributes import NotebooksResponseDataAttributes
383383
from datadog_api_client.v1.model.notebooks_response_meta import NotebooksResponseMeta
384384
from datadog_api_client.v1.model.notebooks_response_page import NotebooksResponsePage
385+
from datadog_api_client.v1.model.on_missing_data_option import OnMissingDataOption
385386
from datadog_api_client.v1.model.org_downgraded_response import OrgDowngradedResponse
386387
from datadog_api_client.v1.model.organization import Organization
387388
from datadog_api_client.v1.model.organization_billing import OrganizationBilling
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-01-06T00:50:53.019Z
1+
2022-08-15T18:04:41.604Z

tests/v1/cassettes/test_scenarios/test_check_if_a_monitor_can_be_deleted_returns_ok_response.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
interactions:
22
- request:
3-
body: '{"message":"some message Notify: @hipchat-channel","name":"Test-Check_if_a_monitor_can_be_deleted_returns_OK_response-1641430253","options":{"enable_logs_sample":true,"escalation_message":"the
4-
situation has escalated","evaluation_delay":700,"groupby_simple_monitor":true,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":24},"priority":3,"query":"logs(\"service:foo
3+
body: '{"message":"some message Notify: @hipchat-channel","name":"Test-Check_if_a_monitor_can_be_deleted_returns_OK_response-1660586681","options":{"enable_logs_sample":true,"escalation_message":"the
4+
situation has escalated","evaluation_delay":700,"groupby_simple_monitor":true,"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
55
AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\")
6-
> 2","tags":["test:testcheckifamonitorcanbedeletedreturnsokresponse1641430253","env:ci"],"type":"log
6+
> 2","tags":["test:testcheckifamonitorcanbedeletedreturnsokresponse1660586681","env:ci"],"type":"log
77
alert"}'
88
headers:
99
accept:
@@ -14,11 +14,11 @@ interactions:
1414
uri: https://api.datadoghq.com/api/v1/monitor
1515
response:
1616
body:
17-
string: '{"restricted_roles":null,"tags":["test:testcheckifamonitorcanbedeletedreturnsokresponse1641430253","env:ci"],"deleted":null,"query":"logs(\"service:foo
17+
string: '{"restricted_roles":null,"tags":["test:testcheckifamonitorcanbedeletedreturnsokresponse1660586681","env:ci"],"deleted":null,"query":"logs(\"service:foo
1818
AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\")
19-
> 2","message":"some message Notify: @hipchat-channel","id":59800600,"multi":true,"name":"Test-Check_if_a_monitor_can_be_deleted_returns_OK_response-1641430253","created":"2022-01-06T00:50:53.280971+00:00","created_at":1641430253000,"creator":{"id":1445416,"handle":"[email protected]","name":null,"email":"[email protected]"},"org_id":321813,"modified":"2022-01-06T00:50:53.280971+00:00","priority":3,"overall_state_modified":null,"overall_state":"No
20-
Data","type":"log alert","options":{"notify_audit":false,"locked":false,"timeout_h":24,"renotify_interval":60,"include_tags":true,"no_data_timeframe":null,"silenced":{},"new_host_delay":600,"require_full_window":true,"notify_no_data":false,"enable_logs_sample":true,"groupby_simple_monitor":true,"escalation_message":"the
21-
situation has escalated","evaluation_delay":700,"thresholds":{"critical":2,"warning":1}}}'
19+
> 2","message":"some message Notify: @hipchat-channel","id":80119046,"multi":true,"name":"Test-Check_if_a_monitor_can_be_deleted_returns_OK_response-1660586681","created":"2022-08-15T18:04:41.951170+00:00","created_at":1660586681000,"creator":{"id":1445416,"handle":"[email protected]","name":null,"email":"[email protected]"},"org_id":321813,"modified":"2022-08-15T18:04:41.951170+00:00","priority":3,"overall_state_modified":null,"overall_state":"No
20+
Data","type":"log alert","options":{"notify_audit":false,"locked":false,"timeout_h":24,"renotify_interval":60,"include_tags":true,"no_data_timeframe":null,"silenced":{},"new_host_delay":600,"on_missing_data":"show_and_notify_no_data","require_full_window":true,"notify_no_data":false,"enable_logs_sample":true,"groupby_simple_monitor":true,"escalation_message":"the
21+
situation has escalated","evaluation_delay":700,"thresholds":{"critical":2.0,"warning":1.0}}}'
2222
headers:
2323
content-type:
2424
- application/json
@@ -31,10 +31,10 @@ interactions:
3131
accept:
3232
- application/json
3333
method: GET
34-
uri: https://api.datadoghq.com/api/v1/monitor/can_delete?monitor_ids=59800600
34+
uri: https://api.datadoghq.com/api/v1/monitor/can_delete?monitor_ids=80119046
3535
response:
3636
body:
37-
string: '{"errors":null,"data":{"ok":[59800600]}}'
37+
string: '{"errors":null,"data":{"ok":[80119046]}}'
3838
headers:
3939
content-type:
4040
- application/json
@@ -47,10 +47,10 @@ interactions:
4747
accept:
4848
- application/json
4949
method: DELETE
50-
uri: https://api.datadoghq.com/api/v1/monitor/59800600
50+
uri: https://api.datadoghq.com/api/v1/monitor/80119046
5151
response:
5252
body:
53-
string: '{"deleted_monitor_id":59800600}'
53+
string: '{"deleted_monitor_id":80119046}'
5454
headers:
5555
content-type:
5656
- application/json
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-01-06T00:50:25.975Z
1+
2022-08-15T18:04:35.875Z

0 commit comments

Comments
 (0)