Skip to content

Commit 5bc591c

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit f0a16bc of spec repo
1 parent bfcd807 commit 5bc591c

4 files changed

Lines changed: 86 additions & 2 deletions

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/main/java/com/datadog/api/client/v1/api/MonitorsApi.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ public CompletableFuture<Monitor> createMonitorAsync(Monitor body) {
279279
* <li><code>#</code>: an integer or decimal number used to set the threshold
280280
* </ul>
281281
*
282+
* <p>To use a dynamic threshold on a metric monitor with a formula query, replace <code>#</code>
283+
* with the <code>threshold</code> keyword (for example, <code>... &gt; threshold</code>) and
284+
* provide the threshold as a query via <code>critical_query</code> on <code>options.thresholds
285+
* </code>. This feature is in preview.
286+
*
282287
* <p>If you are using the <code>_change_</code> or <code>_pct_change_</code> time aggregator,
283288
* instead use <code>change_aggr(time_aggr(time_window),
284289
* timeshift):space_aggr:metric{tags} [by {key}] operator #</code> with:

src/main/java/com/datadog/api/client/v1/model/MonitorThresholds.java

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
/** List of the different monitor threshold available. */
2121
@JsonPropertyOrder({
2222
MonitorThresholds.JSON_PROPERTY_CRITICAL,
23+
MonitorThresholds.JSON_PROPERTY_CRITICAL_QUERY,
2324
MonitorThresholds.JSON_PROPERTY_CRITICAL_RECOVERY,
25+
MonitorThresholds.JSON_PROPERTY_CRITICAL_RECOVERY_QUERY,
2426
MonitorThresholds.JSON_PROPERTY_OK,
2527
MonitorThresholds.JSON_PROPERTY_UNKNOWN,
2628
MonitorThresholds.JSON_PROPERTY_WARNING,
@@ -33,9 +35,15 @@ public class MonitorThresholds {
3335
public static final String JSON_PROPERTY_CRITICAL = "critical";
3436
private Double critical;
3537

38+
public static final String JSON_PROPERTY_CRITICAL_QUERY = "critical_query";
39+
private String criticalQuery;
40+
3641
public static final String JSON_PROPERTY_CRITICAL_RECOVERY = "critical_recovery";
3742
private JsonNullable<Double> criticalRecovery = JsonNullable.<Double>undefined();
3843

44+
public static final String JSON_PROPERTY_CRITICAL_RECOVERY_QUERY = "critical_recovery_query";
45+
private String criticalRecoveryQuery;
46+
3947
public static final String JSON_PROPERTY_OK = "ok";
4048
private JsonNullable<Double> ok = JsonNullable.<Double>undefined();
4149

@@ -69,6 +77,28 @@ public void setCritical(Double critical) {
6977
this.critical = critical;
7078
}
7179

80+
public MonitorThresholds criticalQuery(String criticalQuery) {
81+
this.criticalQuery = criticalQuery;
82+
return this;
83+
}
84+
85+
/**
86+
* Query evaluated as a dynamic <code>CRITICAL</code> threshold. Only supported on metric monitors
87+
* with a formula query. Cannot be combined with static thresholds. This field is in preview.
88+
*
89+
* @return criticalQuery
90+
*/
91+
@jakarta.annotation.Nullable
92+
@JsonProperty(JSON_PROPERTY_CRITICAL_QUERY)
93+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
94+
public String getCriticalQuery() {
95+
return criticalQuery;
96+
}
97+
98+
public void setCriticalQuery(String criticalQuery) {
99+
this.criticalQuery = criticalQuery;
100+
}
101+
72102
public MonitorThresholds criticalRecovery(Double criticalRecovery) {
73103
this.criticalRecovery = JsonNullable.<Double>of(criticalRecovery);
74104
return this;
@@ -100,6 +130,29 @@ public void setCriticalRecovery(Double criticalRecovery) {
100130
this.criticalRecovery = JsonNullable.<Double>of(criticalRecovery);
101131
}
102132

133+
public MonitorThresholds criticalRecoveryQuery(String criticalRecoveryQuery) {
134+
this.criticalRecoveryQuery = criticalRecoveryQuery;
135+
return this;
136+
}
137+
138+
/**
139+
* Query evaluated as a dynamic <code>CRITICAL</code> recovery threshold. Only supported on metric
140+
* monitors with a formula query. Cannot be combined with static thresholds. This field is in
141+
* preview.
142+
*
143+
* @return criticalRecoveryQuery
144+
*/
145+
@jakarta.annotation.Nullable
146+
@JsonProperty(JSON_PROPERTY_CRITICAL_RECOVERY_QUERY)
147+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
148+
public String getCriticalRecoveryQuery() {
149+
return criticalRecoveryQuery;
150+
}
151+
152+
public void setCriticalRecoveryQuery(String criticalRecoveryQuery) {
153+
this.criticalRecoveryQuery = criticalRecoveryQuery;
154+
}
155+
103156
public MonitorThresholds ok(Double ok) {
104157
this.ok = JsonNullable.<Double>of(ok);
105158
return this;
@@ -281,7 +334,9 @@ public boolean equals(Object o) {
281334
}
282335
MonitorThresholds monitorThresholds = (MonitorThresholds) o;
283336
return Objects.equals(this.critical, monitorThresholds.critical)
337+
&& Objects.equals(this.criticalQuery, monitorThresholds.criticalQuery)
284338
&& Objects.equals(this.criticalRecovery, monitorThresholds.criticalRecovery)
339+
&& Objects.equals(this.criticalRecoveryQuery, monitorThresholds.criticalRecoveryQuery)
285340
&& Objects.equals(this.ok, monitorThresholds.ok)
286341
&& Objects.equals(this.unknown, monitorThresholds.unknown)
287342
&& Objects.equals(this.warning, monitorThresholds.warning)
@@ -292,15 +347,27 @@ public boolean equals(Object o) {
292347
@Override
293348
public int hashCode() {
294349
return Objects.hash(
295-
critical, criticalRecovery, ok, unknown, warning, warningRecovery, additionalProperties);
350+
critical,
351+
criticalQuery,
352+
criticalRecovery,
353+
criticalRecoveryQuery,
354+
ok,
355+
unknown,
356+
warning,
357+
warningRecovery,
358+
additionalProperties);
296359
}
297360

298361
@Override
299362
public String toString() {
300363
StringBuilder sb = new StringBuilder();
301364
sb.append("class MonitorThresholds {\n");
302365
sb.append(" critical: ").append(toIndentedString(critical)).append("\n");
366+
sb.append(" criticalQuery: ").append(toIndentedString(criticalQuery)).append("\n");
303367
sb.append(" criticalRecovery: ").append(toIndentedString(criticalRecovery)).append("\n");
368+
sb.append(" criticalRecoveryQuery: ")
369+
.append(toIndentedString(criticalRecoveryQuery))
370+
.append("\n");
304371
sb.append(" ok: ").append(toIndentedString(ok)).append("\n");
305372
sb.append(" unknown: ").append(toIndentedString(unknown)).append("\n");
306373
sb.append(" warning: ").append(toIndentedString(warning)).append("\n");

src/test/resources/com/datadog/api/client/v1/api/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)