Skip to content

Commit 040bf60

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit f0a16bc of spec repo
1 parent 4d78432 commit 040bf60

4 files changed

Lines changed: 33 additions & 1 deletion

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9229,11 +9229,19 @@ components:
92299229
description: The monitor `CRITICAL` threshold.
92309230
format: double
92319231
type: number
9232+
critical_query:
9233+
description: Query evaluated as a dynamic `CRITICAL` threshold. Only supported on metric monitors with a formula query. Cannot be combined with static thresholds. This field is in preview.
9234+
example: 'formula("2 * query1").rollup("avg").last("6mo")'
9235+
type: string
92329236
critical_recovery:
92339237
description: The monitor `CRITICAL` recovery threshold.
92349238
format: double
92359239
nullable: true
92369240
type: number
9241+
critical_recovery_query:
9242+
description: Query evaluated as a dynamic `CRITICAL` recovery threshold. Only supported on metric monitors with a formula query. Cannot be combined with static thresholds. This field is in preview.
9243+
example: 'formula("1.5 * query1").rollup("avg").last("3mo")'
9244+
type: string
92379245
ok:
92389246
description: The monitor `OK` threshold.
92399247
format: double
@@ -33700,6 +33708,10 @@ paths:
3370033708
- `operator`: <, <=, >, >=, ==, or !=
3370133709
- `#`: an integer or decimal number used to set the threshold
3370233710

33711+
To use a dynamic threshold on a metric monitor with a formula query, replace `#` with the `threshold` keyword
33712+
(for example, `... > threshold`) and provide the threshold as a query via `critical_query` on `options.thresholds`.
33713+
This feature is in preview.
33714+
3370333715
If you are using the `_change_` or `_pct_change_` time aggregator, instead use `change_aggr(time_aggr(time_window),
3370433716
timeshift):space_aggr:metric{tags} [by {key}] operator #` with:
3370533717

src/datadog_api_client/v1/api/monitors_api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,10 @@ def create_monitor(
425425
* ``operator`` : <, <=, >, >=, ==, or !=
426426
* ``#`` : an integer or decimal number used to set the threshold
427427
428+
To use a dynamic threshold on a metric monitor with a formula query, replace ``#`` with the ``threshold`` keyword
429+
(for example, ``... > threshold`` ) and provide the threshold as a query via ``critical_query`` on ``options.thresholds``.
430+
This feature is in preview.
431+
428432
If you are using the ``_change_`` or ``_pct_change_`` time aggregator, instead use ``change_aggr(time_aggr(time_window),
429433
timeshift):space_aggr:metric{tags} [by {key}] operator #`` with:
430434

src/datadog_api_client/v1/model/monitor_thresholds.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ class MonitorThresholds(ModelNormal):
1919
def openapi_types(_):
2020
return {
2121
"critical": (float,),
22+
"critical_query": (str,),
2223
"critical_recovery": (float, none_type),
24+
"critical_recovery_query": (str,),
2325
"ok": (float, none_type),
2426
"unknown": (float, none_type),
2527
"warning": (float, none_type),
@@ -28,7 +30,9 @@ def openapi_types(_):
2830

2931
attribute_map = {
3032
"critical": "critical",
33+
"critical_query": "critical_query",
3134
"critical_recovery": "critical_recovery",
35+
"critical_recovery_query": "critical_recovery_query",
3236
"ok": "ok",
3337
"unknown": "unknown",
3438
"warning": "warning",
@@ -38,7 +42,9 @@ def openapi_types(_):
3842
def __init__(
3943
self_,
4044
critical: Union[float, UnsetType] = unset,
45+
critical_query: Union[str, UnsetType] = unset,
4146
critical_recovery: Union[float, none_type, UnsetType] = unset,
47+
critical_recovery_query: Union[str, UnsetType] = unset,
4248
ok: Union[float, none_type, UnsetType] = unset,
4349
unknown: Union[float, none_type, UnsetType] = unset,
4450
warning: Union[float, none_type, UnsetType] = unset,
@@ -51,9 +57,15 @@ def __init__(
5157
:param critical: The monitor ``CRITICAL`` threshold.
5258
:type critical: float, optional
5359
60+
:param critical_query: Query evaluated as a dynamic ``CRITICAL`` threshold. Only supported on metric monitors with a formula query. Cannot be combined with static thresholds. This field is in preview.
61+
:type critical_query: str, optional
62+
5463
:param critical_recovery: The monitor ``CRITICAL`` recovery threshold.
5564
:type critical_recovery: float, none_type, optional
5665
66+
:param critical_recovery_query: Query evaluated as a dynamic ``CRITICAL`` recovery threshold. Only supported on metric monitors with a formula query. Cannot be combined with static thresholds. This field is in preview.
67+
:type critical_recovery_query: str, optional
68+
5769
:param ok: The monitor ``OK`` threshold.
5870
:type ok: float, none_type, optional
5971
@@ -68,8 +80,12 @@ def __init__(
6880
"""
6981
if critical is not unset:
7082
kwargs["critical"] = critical
83+
if critical_query is not unset:
84+
kwargs["critical_query"] = critical_query
7185
if critical_recovery is not unset:
7286
kwargs["critical_recovery"] = critical_recovery
87+
if critical_recovery_query is not unset:
88+
kwargs["critical_recovery_query"] = critical_recovery_query
7389
if ok is not unset:
7490
kwargs["ok"] = ok
7591
if unknown is not unset:

tests/v1/features/monitors.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ Feature: Monitors
219219
Scenario: Edit a monitor returns "Bad Request" response
220220
Given new "UpdateMonitor" request
221221
And request contains "monitor_id" parameter from "REPLACE.ME"
222-
And body with value {"assets": [{"category": "runbook", "name": "Monitor Runbook", "resource_key": "12345", "resource_type": "notebook", "url": "/notebooks/12345"}], "draft_status": "published", "options": {"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, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "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", "name": "compute_result", "source": "filter_query"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}, "source": "filter_query"}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"}
222+
And body with value {"assets": [{"category": "runbook", "name": "Monitor Runbook", "resource_key": "12345", "resource_type": "notebook", "url": "/notebooks/12345"}], "draft_status": "published", "options": {"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, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_query": "formula(\"2 * query1\").rollup(\"avg\").last(\"6mo\")", "critical_recovery": null, "critical_recovery_query": "formula(\"1.5 * query1\").rollup(\"avg\").last(\"3mo\")", "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration", "name": "compute_result", "source": "filter_query"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}, "source": "filter_query"}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"}
223223
When the request is sent
224224
Then the response status is 400 Bad Request
225225

0 commit comments

Comments
 (0)