From ce1d4ee95c3b5773265a813c04f35a1281d7791f Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 22 May 2026 17:11:43 +0000 Subject: [PATCH] Regenerate client from commit 2f6b36f of spec repo --- .generator/schemas/v1/openapi.yaml | 12 ++++ .../api/client/v1/api/MonitorsApi.java | 5 ++ .../client/v1/model/MonitorThresholds.java | 70 ++++++++++++++++++- .../api/client/v1/api/monitors.feature | 2 +- 4 files changed, 87 insertions(+), 2 deletions(-) diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 51fe22bcea0..25a447b5795 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -9229,11 +9229,19 @@ components: description: The monitor `CRITICAL` threshold. format: double type: number + critical_query: + description: Query evaluated as a dynamic `CRITICAL` threshold. Only supported on metric monitors with a formula query and options['variables']. Cannot be combined with static thresholds. This field is in preview. + example: 'formula("2 * query1").rollup("avg").last("6mo")' + type: string critical_recovery: description: The monitor `CRITICAL` recovery threshold. format: double nullable: true type: number + critical_recovery_query: + description: Query evaluated as a dynamic `CRITICAL` recovery threshold. Only supported on metric monitors with a formula query and options['variables']. Cannot be combined with static thresholds. This field is in preview. + example: 'formula("1.5 * query1").rollup("avg").last("3mo")' + type: string ok: description: The monitor `OK` threshold. format: double @@ -33700,6 +33708,10 @@ paths: - `operator`: <, <=, >, >=, ==, or != - `#`: an integer or decimal number used to set the threshold + To use a dynamic threshold on a metric monitor with a formula query, replace `#` with the `threshold` keyword + (for example, `... > threshold`) and provide the threshold as a query via `critical_query` on `options.thresholds`. + This feature is in preview. + If you are using the `_change_` or `_pct_change_` time aggregator, instead use `change_aggr(time_aggr(time_window), timeshift):space_aggr:metric{tags} [by {key}] operator #` with: diff --git a/src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java b/src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java index 1d5cc30dc26..0aaaa67bcd7 100644 --- a/src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java +++ b/src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java @@ -279,6 +279,11 @@ public CompletableFuture createMonitorAsync(Monitor body) { *
  • #: an integer or decimal number used to set the threshold * * + *

    To use a dynamic threshold on a metric monitor with a formula query, replace # + * with the threshold keyword (for example, ... > threshold) and + * provide the threshold as a query via critical_query on options.thresholds + * . This feature is in preview. + * *

    If you are using the _change_ or _pct_change_ time aggregator, * instead use change_aggr(time_aggr(time_window), * timeshift):space_aggr:metric{tags} [by {key}] operator # with: diff --git a/src/main/java/com/datadog/api/client/v1/model/MonitorThresholds.java b/src/main/java/com/datadog/api/client/v1/model/MonitorThresholds.java index f744553f593..8b1a8b607d4 100644 --- a/src/main/java/com/datadog/api/client/v1/model/MonitorThresholds.java +++ b/src/main/java/com/datadog/api/client/v1/model/MonitorThresholds.java @@ -20,7 +20,9 @@ /** List of the different monitor threshold available. */ @JsonPropertyOrder({ MonitorThresholds.JSON_PROPERTY_CRITICAL, + MonitorThresholds.JSON_PROPERTY_CRITICAL_QUERY, MonitorThresholds.JSON_PROPERTY_CRITICAL_RECOVERY, + MonitorThresholds.JSON_PROPERTY_CRITICAL_RECOVERY_QUERY, MonitorThresholds.JSON_PROPERTY_OK, MonitorThresholds.JSON_PROPERTY_UNKNOWN, MonitorThresholds.JSON_PROPERTY_WARNING, @@ -33,9 +35,15 @@ public class MonitorThresholds { public static final String JSON_PROPERTY_CRITICAL = "critical"; private Double critical; + public static final String JSON_PROPERTY_CRITICAL_QUERY = "critical_query"; + private String criticalQuery; + public static final String JSON_PROPERTY_CRITICAL_RECOVERY = "critical_recovery"; private JsonNullable criticalRecovery = JsonNullable.undefined(); + public static final String JSON_PROPERTY_CRITICAL_RECOVERY_QUERY = "critical_recovery_query"; + private String criticalRecoveryQuery; + public static final String JSON_PROPERTY_OK = "ok"; private JsonNullable ok = JsonNullable.undefined(); @@ -69,6 +77,29 @@ public void setCritical(Double critical) { this.critical = critical; } + public MonitorThresholds criticalQuery(String criticalQuery) { + this.criticalQuery = criticalQuery; + return this; + } + + /** + * Query evaluated as a dynamic CRITICAL threshold. Only supported on metric monitors + * with a formula query and options['variables']. Cannot be combined with static thresholds. This + * field is in preview. + * + * @return criticalQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CRITICAL_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCriticalQuery() { + return criticalQuery; + } + + public void setCriticalQuery(String criticalQuery) { + this.criticalQuery = criticalQuery; + } + public MonitorThresholds criticalRecovery(Double criticalRecovery) { this.criticalRecovery = JsonNullable.of(criticalRecovery); return this; @@ -100,6 +131,29 @@ public void setCriticalRecovery(Double criticalRecovery) { this.criticalRecovery = JsonNullable.of(criticalRecovery); } + public MonitorThresholds criticalRecoveryQuery(String criticalRecoveryQuery) { + this.criticalRecoveryQuery = criticalRecoveryQuery; + return this; + } + + /** + * Query evaluated as a dynamic CRITICAL recovery threshold. Only supported on metric + * monitors with a formula query and options['variables']. Cannot be combined with static + * thresholds. This field is in preview. + * + * @return criticalRecoveryQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CRITICAL_RECOVERY_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCriticalRecoveryQuery() { + return criticalRecoveryQuery; + } + + public void setCriticalRecoveryQuery(String criticalRecoveryQuery) { + this.criticalRecoveryQuery = criticalRecoveryQuery; + } + public MonitorThresholds ok(Double ok) { this.ok = JsonNullable.of(ok); return this; @@ -281,7 +335,9 @@ public boolean equals(Object o) { } MonitorThresholds monitorThresholds = (MonitorThresholds) o; return Objects.equals(this.critical, monitorThresholds.critical) + && Objects.equals(this.criticalQuery, monitorThresholds.criticalQuery) && Objects.equals(this.criticalRecovery, monitorThresholds.criticalRecovery) + && Objects.equals(this.criticalRecoveryQuery, monitorThresholds.criticalRecoveryQuery) && Objects.equals(this.ok, monitorThresholds.ok) && Objects.equals(this.unknown, monitorThresholds.unknown) && Objects.equals(this.warning, monitorThresholds.warning) @@ -292,7 +348,15 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( - critical, criticalRecovery, ok, unknown, warning, warningRecovery, additionalProperties); + critical, + criticalQuery, + criticalRecovery, + criticalRecoveryQuery, + ok, + unknown, + warning, + warningRecovery, + additionalProperties); } @Override @@ -300,7 +364,11 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MonitorThresholds {\n"); sb.append(" critical: ").append(toIndentedString(critical)).append("\n"); + sb.append(" criticalQuery: ").append(toIndentedString(criticalQuery)).append("\n"); sb.append(" criticalRecovery: ").append(toIndentedString(criticalRecovery)).append("\n"); + sb.append(" criticalRecoveryQuery: ") + .append(toIndentedString(criticalRecoveryQuery)) + .append("\n"); sb.append(" ok: ").append(toIndentedString(ok)).append("\n"); sb.append(" unknown: ").append(toIndentedString(unknown)).append("\n"); sb.append(" warning: ").append(toIndentedString(warning)).append("\n"); diff --git a/src/test/resources/com/datadog/api/client/v1/api/monitors.feature b/src/test/resources/com/datadog/api/client/v1/api/monitors.feature index 73ed30421fb..e3e5ca6c410 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/monitors.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/monitors.feature @@ -219,7 +219,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 {"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"} + 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"} When the request is sent Then the response status is 400 Bad Request