From 441468f8b365fd13fe97e811015baa23c393f498 Mon Sep 17 00:00:00 2001 From: datadog-bits <263423550+datadog-bits@users.noreply.github.com> Date: Thu, 12 Nov 2026 23:25:14 +0000 Subject: [PATCH 1/5] Document relative monitor thresholds in Preview Co-authored-by: phillip-dd <59581508+phillip-dd@users.noreply.github.com> --- .../en/monitors/configuration/_index.md | 16 ++++- .../monitors/guide/non_static_thresholds.md | 70 ++++++++++++++++++- hugo/content/en/monitors/types/metric.md | 12 +++- 3 files changed, 94 insertions(+), 4 deletions(-) diff --git a/hugo/content/en/monitors/configuration/_index.md b/hugo/content/en/monitors/configuration/_index.md index 3079eb273398..454db8740be3 100644 --- a/hugo/content/en/monitors/configuration/_index.md +++ b/hugo/content/en/monitors/configuration/_index.md @@ -140,7 +140,9 @@ For more information, see the guide on how to [Customize monitor evaluation freq ### Thresholds -Use thresholds to set a numeric value for triggering an alert. Depending on your chosen metric, the editor displays the unit used (`byte`, `kibibyte`, `gibibyte`, etc). +Use thresholds to define when a monitor triggers an alert. A static threshold compares the evaluated value to a fixed number. Metric monitors also support [relative thresholds (Preview)](#relative-thresholds), which adapt to a historical baseline. Depending on your chosen metric, the editor displays the unit used (`byte`, `kibibyte`, `gibibyte`, etc). + +#### Static thresholds Datadog has two types of notifications (alert and warning). Monitors recover automatically based on the alert or warning threshold but additional conditions can be specified. For additional information on recovery thresholds, see [What are recovery thresholds?][5]. For example, if a monitor alerts when the metric is above `3` and recovery thresholds are not specified, the monitor recovers once the metric value goes back below `3`. @@ -157,6 +159,17 @@ As you change a threshold, the preview graph in the editor displays a marker sho **Note**: When entering decimal values for thresholds, if your value is `<1`, add a leading `0` to the number. For example, use `0.5`, not `.5`. +#### Relative thresholds + +{{< callout url="#" btn_hidden="true" header="Preview" >}} +Relative thresholds, also called dynamic thresholds, are in Preview for metric monitors. +{{< /callout >}} + +A relative threshold uses historical data from the same monitor query as its baseline. Configure a baseline time window, an aggregation, and a multiplier. Datadog multiplies the aggregated baseline by the multiplier to calculate the threshold. For monitors grouped by tags, each group has its own baseline and threshold. + +For example, a threshold of 150% of the historical average alerts when the evaluated value is more than 50% above that average. The monitor's evaluation window and the baseline window are separate settings. + +For configuration examples, see [Relative thresholds in the non-static thresholds guide][7]. [1]: /monitors/guide/monitor_aggregators/ [2]: /monitors/guide/as-count-in-monitor-evaluations/ @@ -164,6 +177,7 @@ As you change a threshold, the preview graph in the editor displays a marker sho [4]: /monitors/guide/custom_schedules [5]: /monitors/guide/recovery-thresholds/ [6]: /monitors/types/log/ +[7]: /monitors/guide/non_static_thresholds/#relative-thresholds {{% /tab %}} {{% tab "Check alert" %}} diff --git a/hugo/content/en/monitors/guide/non_static_thresholds.md b/hugo/content/en/monitors/guide/non_static_thresholds.md index 66fce7da5fb6..576328c20719 100644 --- a/hugo/content/en/monitors/guide/non_static_thresholds.md +++ b/hugo/content/en/monitors/guide/non_static_thresholds.md @@ -1,6 +1,6 @@ --- title: How to monitor non-static thresholds -description: "Monitor variable thresholds using seasonal patterns, reference metrics, and composite monitors for dynamic alerting scenarios." +description: "Monitor variable thresholds using relative thresholds (Preview), seasonal patterns, reference metrics, and composite monitors." further_reading: - link: "/monitors/types/composite/" tag: "Documentation" @@ -16,10 +16,75 @@ A typical metric monitor triggers an alert if a single metric goes above a speci Watchdog powered monitors (namely [anomaly][1] and [outlier][2]) are particularly useful when there isn't an explicit definition of your metric being off-track. However, when possible, you should use regular monitors with tailored alert conditions to maximize precision and minimize time-to-alert for your specific use case. -This guide covers common use cases for alerting on non-static thresholds: +Choose an approach based on the comparison you need: + - [Use a **relative threshold (Preview)** to compare a metric to its historical baseline](#relative-thresholds) - [Alert on a metric that goes off track outside of **seasonal variations**](#seasonal-threshold) - [Alert based on the value of another **reference** metric](#reference-threshold) +## Relative thresholds + +{{< callout url="#" btn_hidden="true" header="Preview" >}} +Relative thresholds, also called dynamic thresholds, are in Preview for metric monitors. +{{< /callout >}} + +A relative threshold compares the evaluated value of a metric monitor to a historical baseline from the same query. Datadog calculates the baseline using a separate time window and aggregation, then multiplies it by a factor to determine the threshold. The threshold adapts as the baseline changes. For monitors grouped by tags, each group uses its own historical baseline. + +Use a relative threshold when the alert boundary should follow a metric's historical level. For example, alert when the average CPU usage over five minutes exceeds 150% of its historical average. A threshold of 150% of the baseline means 50% above the baseline, not a 150% increase. + +### Configure a relative threshold + +The following example compares each host's average CPU usage over five minutes to 150% of its average CPU usage over one week. + +{{< tabs >}} +{{% tab "UI Configuration" %}} + +1. Create a [metric monitor][6] with the **Threshold** detection method. +2. Query `avg:system.cpu.user{env:prod} by {host}`. +3. Evaluate the average over the last five minutes. +4. In **Set alert conditions**, configure a relative threshold. Trigger when the evaluated value is above 150% of the average over the last week. + +{{% /tab %}} +{{% tab "JSON Example" %}} + +```json +{ + "name": "CPU usage above its historical baseline", + "type": "query alert", + "query": "formula(\"query1\").rollup(\"avg\").last(\"5m\") > threshold", + "message": "CPU usage exceeds 150% of its historical average.", + "options": { + "thresholds": { + "critical_query": "formula(\"query1\").rollup(\"avg\").last(\"1w\").multiplier(1.5)" + }, + "variables": [ + { + "data_source": "metrics", + "name": "query1", + "query": "avg:system.cpu.user{env:prod} by {host}" + } + ] + } +} +``` + +The main `query` compares the evaluated value to the `threshold` keyword. The `options.thresholds.critical_query` expression defines that threshold: + +- `formula("query1")` uses the same metric query as the monitor. +- `.rollup("avg").last("1w")` calculates the historical average over one week. +- `.multiplier(1.5)` scales that baseline to 150%. The multiplier is a factor, so use `1.5`, not `150`. + +For example, if a host's historical average is 20%, the alert threshold is 30%. To detect a drop below 80% of the baseline, use `< threshold` in the main query and `.multiplier(0.8)` in the threshold query. + +{{% /tab %}} +{{< /tabs >}} + +### Preview considerations + +- Relative thresholds support metric monitors with formulas and functions. +- A group needs historical data to establish its baseline. A new group without a historical baseline cannot be evaluated against a relative threshold. + +For a comparison to the same time in a previous week, use the [seasonal threshold example](#seasonal-threshold). For a comparison to a different metric, use the [reference threshold example](#reference-threshold). + ## Seasonal threshold ### Context @@ -187,3 +252,4 @@ The last monitor is a Composite monitor, which sends an alert only if the two pr [3]: /integrations/nginx/?tab=host#data-collected [4]: /account_management/billing/usage_metrics/#types-of-usage [5]: /logs/log_configuration/logs_to_metrics/#logs-usage-metrics +[6]: /monitors/types/metric/ diff --git a/hugo/content/en/monitors/types/metric.md b/hugo/content/en/monitors/types/metric.md index da6e5b5ab3e7..afec78541d01 100644 --- a/hugo/content/en/monitors/types/metric.md +++ b/hugo/content/en/monitors/types/metric.md @@ -31,13 +31,20 @@ To create a metric monitor in Datadog, navigate to [{{< ui >}}Monitors{{< /ui >} {{< tabs >}} {{% tab "Threshold" %}} -A threshold alert compares metric values to a static threshold. +A threshold alert compares metric values to a static threshold or a relative threshold (Preview). A static threshold is a fixed number. A relative threshold, also called a dynamic threshold, adapts to a historical baseline from the same query. On each alert evaluation, Datadog calculates the average, minimum, maximum, or sum over the selected period and checks if it is above, below, equal to, or not equal to the threshold. This is for standard alert cases where you know the expected values. The [distribution metric type][1] offers the additional threshold option of calculating percentiles over the selected period. For more information, see the [Set alert conditions](#set-alert-conditions) section. +{{< callout url="#" btn_hidden="true" header="Preview" >}} +Relative thresholds are in Preview. +{{< /callout >}} + +For examples and Preview limitations, see [Relative thresholds][2]. + [1]: /metrics/distributions/ +[2]: /monitors/guide/non_static_thresholds/#relative-thresholds {{% /tab %}} {{% tab "Change" %}} @@ -165,6 +172,8 @@ Trigger when the metric is one of the following: If the value is between zero and one, a leading zero is required. For example, `0.3`. +For static and relative threshold (Preview) settings, see [Thresholds in monitor configuration][9]. + ### Advanced alert conditions #### Data window @@ -223,3 +232,4 @@ For instructions on the {{< ui >}}Configure notifications and automations{{< /ui [6]: /monitors/configuration/#advanced-alert-conditions [7]: /monitors/notify/ [8]: /monitors/configuration/?tab=thresholdalert#configure-notifications-and-automations +[9]: /monitors/configuration/?tab=thresholdalert#thresholds From af400b7cca9c2ad1f7aafdfab2b01e6d81a13c86 Mon Sep 17 00:00:00 2001 From: datadog-bits <263423550+datadog-bits@users.noreply.github.com> Date: Fri, 13 Nov 2026 04:18:05 +0000 Subject: [PATCH 2/5] Add standalone relative thresholds guide Co-authored-by: phillip-dd <59581508+phillip-dd@users.noreply.github.com> --- .../en/monitors/configuration/_index.md | 16 +- hugo/content/en/monitors/guide/_index.md | 1 + .../monitors/guide/non_static_thresholds.md | 60 +---- .../en/monitors/guide/relative-thresholds.md | 246 ++++++++++++++++++ hugo/content/en/monitors/types/metric.md | 2 +- 5 files changed, 266 insertions(+), 59 deletions(-) create mode 100644 hugo/content/en/monitors/guide/relative-thresholds.md diff --git a/hugo/content/en/monitors/configuration/_index.md b/hugo/content/en/monitors/configuration/_index.md index 454db8740be3..dd2f3ea889aa 100644 --- a/hugo/content/en/monitors/configuration/_index.md +++ b/hugo/content/en/monitors/configuration/_index.md @@ -165,11 +165,19 @@ As you change a threshold, the preview graph in the editor displays a marker sho Relative thresholds, also called dynamic thresholds, are in Preview for metric monitors. {{< /callout >}} -A relative threshold uses historical data from the same monitor query as its baseline. Configure a baseline time window, an aggregation, and a multiplier. Datadog multiplies the aggregated baseline by the multiplier to calculate the threshold. For monitors grouped by tags, each group has its own baseline and threshold. +A relative threshold uses historical data from the same monitor query as its baseline. Datadog applies an optional multiplier to the aggregated baseline to calculate the threshold. For monitors grouped by tags, each group has its own baseline and threshold. -For example, a threshold of 150% of the historical average alerts when the evaluated value is more than 50% above that average. The monitor's evaluation window and the baseline window are separate settings. +To configure a relative threshold in **Set alert conditions**: -For configuration examples, see [Relative thresholds in the non-static thresholds guide][7]. +1. Select a relative threshold and choose the alert direction. +2. Select a historical aggregation and a lookback window from 1 week to 6 months. The historical window must be at least as long as the monitor's evaluation window. +3. Set the multiplier and, optionally, a critical recovery threshold. For example, alert above 150% of the historical average and recover at or below 120% of that average. + +Historical thresholds are recalculated daily at midnight UTC and remain constant between updates. The monitor's evaluation frequency continues to control how often Datadog compares current values to those thresholds. + +Relative thresholds support critical threshold queries and critical recovery threshold queries. Relative warning thresholds are not supported in Preview, and static and relative thresholds cannot be combined in the same monitor. + +For configuration examples, query syntax, and limitations, see the [Relative Thresholds guide][7]. [1]: /monitors/guide/monitor_aggregators/ [2]: /monitors/guide/as-count-in-monitor-evaluations/ @@ -177,7 +185,7 @@ For configuration examples, see [Relative thresholds in the non-static threshold [4]: /monitors/guide/custom_schedules [5]: /monitors/guide/recovery-thresholds/ [6]: /monitors/types/log/ -[7]: /monitors/guide/non_static_thresholds/#relative-thresholds +[7]: /monitors/guide/relative-thresholds/ {{% /tab %}} {{% tab "Check alert" %}} diff --git a/hugo/content/en/monitors/guide/_index.md b/hugo/content/en/monitors/guide/_index.md index ae1896496752..957b16d49e64 100644 --- a/hugo/content/en/monitors/guide/_index.md +++ b/hugo/content/en/monitors/guide/_index.md @@ -33,6 +33,7 @@ cascade: {{< whatsnext desc="Monitor configuration:" >}} {{< nextlink href="monitors/guide/best-practices-for-live-process-monitoring" >}}Best practices for Live Process Monitoring{{< /nextlink >}} {{< nextlink href="monitors/guide/non_static_thresholds" >}}How to monitor non-static thresholds{{< /nextlink >}} + {{< nextlink href="monitors/guide/relative-thresholds" >}}Relative thresholds (Preview){{< /nextlink >}} {{< nextlink href="monitors/guide/anomaly-monitor" >}}Anomaly monitors{{< /nextlink >}} {{< nextlink href="monitors/guide/monitoring-sparse-metrics" >}}Monitoring Sparse Metrics{{< /nextlink >}} {{< nextlink href="monitors/guide/monitor-arithmetic-and-sparse-metrics" >}}Monitor arithmetic and sparse metrics{{< /nextlink >}} diff --git a/hugo/content/en/monitors/guide/non_static_thresholds.md b/hugo/content/en/monitors/guide/non_static_thresholds.md index 576328c20719..021d622a6682 100644 --- a/hugo/content/en/monitors/guide/non_static_thresholds.md +++ b/hugo/content/en/monitors/guide/non_static_thresholds.md @@ -27,63 +27,15 @@ Choose an approach based on the comparison you need: Relative thresholds, also called dynamic thresholds, are in Preview for metric monitors. {{< /callout >}} -A relative threshold compares the evaluated value of a metric monitor to a historical baseline from the same query. Datadog calculates the baseline using a separate time window and aggregation, then multiplies it by a factor to determine the threshold. The threshold adapts as the baseline changes. For monitors grouped by tags, each group uses its own historical baseline. +A relative threshold compares the evaluated value of a metric monitor to a historical baseline from the same query. Datadog calculates a separate threshold for each group, so one monitor can cover resources with different normal values. -Use a relative threshold when the alert boundary should follow a metric's historical level. For example, alert when the average CPU usage over five minutes exceeds 150% of its historical average. A threshold of 150% of the baseline means 50% above the baseline, not a 150% increase. +For example, alert when the average job duration over five minutes exceeds 150% of its average over the last week. A threshold of 150% of the baseline means 50% above the baseline, not a 150% increase. -### Configure a relative threshold +Choose a historical aggregation and a lookback window from 1 week to 6 months. Historical thresholds are recalculated daily at midnight UTC and remain constant between updates. The monitor continues evaluating current values at its configured evaluation frequency. -The following example compares each host's average CPU usage over five minutes to 150% of its average CPU usage over one week. +For configuration steps, query syntax, critical recovery thresholds, and Preview limitations, see the [Relative Thresholds guide][6]. -{{< tabs >}} -{{% tab "UI Configuration" %}} - -1. Create a [metric monitor][6] with the **Threshold** detection method. -2. Query `avg:system.cpu.user{env:prod} by {host}`. -3. Evaluate the average over the last five minutes. -4. In **Set alert conditions**, configure a relative threshold. Trigger when the evaluated value is above 150% of the average over the last week. - -{{% /tab %}} -{{% tab "JSON Example" %}} - -```json -{ - "name": "CPU usage above its historical baseline", - "type": "query alert", - "query": "formula(\"query1\").rollup(\"avg\").last(\"5m\") > threshold", - "message": "CPU usage exceeds 150% of its historical average.", - "options": { - "thresholds": { - "critical_query": "formula(\"query1\").rollup(\"avg\").last(\"1w\").multiplier(1.5)" - }, - "variables": [ - { - "data_source": "metrics", - "name": "query1", - "query": "avg:system.cpu.user{env:prod} by {host}" - } - ] - } -} -``` - -The main `query` compares the evaluated value to the `threshold` keyword. The `options.thresholds.critical_query` expression defines that threshold: - -- `formula("query1")` uses the same metric query as the monitor. -- `.rollup("avg").last("1w")` calculates the historical average over one week. -- `.multiplier(1.5)` scales that baseline to 150%. The multiplier is a factor, so use `1.5`, not `150`. - -For example, if a host's historical average is 20%, the alert threshold is 30%. To detect a drop below 80% of the baseline, use `< threshold` in the main query and `.multiplier(0.8)` in the threshold query. - -{{% /tab %}} -{{< /tabs >}} - -### Preview considerations - -- Relative thresholds support metric monitors with formulas and functions. -- A group needs historical data to establish its baseline. A new group without a historical baseline cannot be evaluated against a relative threshold. - -For a comparison to the same time in a previous week, use the [seasonal threshold example](#seasonal-threshold). For a comparison to a different metric, use the [reference threshold example](#reference-threshold). +Use a relative threshold to detect a known degree of change from a historical level. For a comparison to the same time in a previous week, use the [seasonal threshold example](#seasonal-threshold). For a comparison to a different metric, use the [reference threshold example](#reference-threshold). ## Seasonal threshold @@ -252,4 +204,4 @@ The last monitor is a Composite monitor, which sends an alert only if the two pr [3]: /integrations/nginx/?tab=host#data-collected [4]: /account_management/billing/usage_metrics/#types-of-usage [5]: /logs/log_configuration/logs_to_metrics/#logs-usage-metrics -[6]: /monitors/types/metric/ +[6]: /monitors/guide/relative-thresholds/ diff --git a/hugo/content/en/monitors/guide/relative-thresholds.md b/hugo/content/en/monitors/guide/relative-thresholds.md new file mode 100644 index 000000000000..038343bd8d8b --- /dev/null +++ b/hugo/content/en/monitors/guide/relative-thresholds.md @@ -0,0 +1,246 @@ +--- +title: Relative Thresholds +description: "Configure relative thresholds (Preview) to compare metric values with historical baselines, including query syntax, recovery thresholds, and limitations." +further_reading: +- link: "/monitors/types/metric/" + tag: "Documentation" + text: "Metric Monitors" +- link: "/monitors/configuration/" + tag: "Documentation" + text: "Configure Monitors" +- link: "/monitors/types/anomaly/" + tag: "Documentation" + text: "Anomaly Detection Monitors" +- link: "/monitors/guide/non_static_thresholds/" + tag: "Documentation" + text: "How to Monitor Non-Static Thresholds" +- link: "/api/latest/monitors/" + tag: "API" + text: "Monitors API" +--- + +## Overview + +{{< callout url="#" btn_hidden="true" header="Preview" >}} +Relative thresholds, also called dynamic thresholds, are in Preview and are available for metric monitors. +{{< /callout >}} + +Relative thresholds let you alert when a metric deviates from its historical behavior, without choosing a fixed threshold. + +Instead of alerting when a metric exceeds a specific value, such as 100 ms, alert when it exceeds a percentage of its historical baseline. For example, alert when a metric exceeds 150% of its average over the past week. + +Relative thresholds are useful for metrics whose normal values vary between services, hosts, or other groups, or gradually change over time. They provide an alternative to static thresholds and anomaly detection when you want to detect a known degree of change. + +## How relative thresholds work + +A relative threshold compares two values: + +- **Current value:** The metric value calculated over the monitor's evaluation window, such as the average over the last 5 minutes. +- **Historical threshold:** A threshold calculated from historical metric data, optionally multiplied by a factor. + +For example, configure a monitor to alert when: + +`Average over the last 5 minutes > 1.5 × Average over the last week` + +If a service's historical average request latency is 200 ms, its alert threshold is 300 ms. If the historical average later increases to 250 ms, its alert threshold becomes 375 ms. + +Unlike a static threshold, the threshold adapts to the metric's historical behavior. + +### Historical baseline + +The historical threshold is calculated using an aggregation over a longer time window. The aggregation and time window determine how the baseline responds to past behavior. + +Relative thresholds support historical windows from 1 week to 6 months. + +**Historical thresholds are recalculated daily at midnight UTC.** The calculated threshold remains constant between updates, while the monitor continues evaluating current metric values at its configured evaluation frequency. + +This provides a stable baseline that adjusts to longer-term changes without reacting immediately to every short-term fluctuation. + +### Grouped monitors + +For monitors grouped by dimensions such as `service`, `host`, or `region`, Datadog calculates a separate historical threshold for each group. + +For example, a monitor grouped by `service` might have the following values: + +| Service | Historical average | Multiplier | Alert threshold | +|---|---:|---:|---:| +| Service A | 100 ms | 1.5 | 150 ms | +| Service B | 400 ms | 1.5 | 600 ms | +| Service C | 800 ms | 1.5 | 1200 ms | + +Each service is evaluated independently against its own threshold. + +This allows a single monitor to cover services with different normal operating characteristics without requiring separate static thresholds. + +## Configure a relative threshold + +To configure a relative threshold: + +1. Create or edit a [metric monitor][1]. +2. Define the metric and its evaluation window. +3. In the alert conditions, select a relative threshold. +4. Select the historical aggregation and lookback window. +5. Set a multiplier that determines how much the current value can deviate from the historical baseline. +6. Configure the alert direction and, optionally, a recovery threshold. +7. Review the resulting thresholds and monitor behavior before saving. + +For an alert configured to trigger above the threshold, a multiplier of `1.5` triggers when the current value exceeds 150% of its historical baseline. A multiplier of `0.7` can detect a drop below 70% of the baseline when the alert direction is below the threshold. + +### Query syntax + +Relative thresholds are supported in metric monitors using Formulas and Functions queries. + +The monitor query uses `threshold` as a placeholder for the calculated threshold: + +```text +formula("query1").rollup("avg").last("5m") > threshold +``` + +The historical threshold is defined in `options.thresholds.critical_query`: + +```text +formula("query1").rollup("avg").last("1w").multiplier(1.5) +``` + +The historical query has the following structure: + +```text +formula("").rollup("").last("").multiplier() +``` + +- `formula`: A formula referencing the metric query variables. Formulas can contain arithmetic expressions. +- `rollup`: The aggregation used to calculate the historical value, such as `avg`. +- `last`: The historical lookback window, such as `1w` or `1mo`. +- `multiplier`: An optional numeric multiplier applied to the aggregated historical value. + +The multiplier applies to the result of the historical aggregation, rather than to individual datapoints. The multiplier is a factor: use `1.5` for 150% of the baseline, which is 50% above the baseline. + +### API example + +The following example alerts when the average job duration over 5 minutes exceeds 150% of its historical weekly average, grouped by job. + +```json +{ + "name": "Job duration above historical baseline", + "type": "query alert", + "query": "formula(\"query1\").rollup(\"avg\").last(\"5m\") > threshold", + "message": "Job duration is above its historical baseline.", + "options": { + "thresholds": { + "critical_query": "formula(\"query1\").rollup(\"avg\").last(\"1w\").multiplier(1.5)", + "critical_recovery_query": "formula(\"query1\").rollup(\"avg\").last(\"1w\").multiplier(1.2)" + }, + "variables": [ + { + "name": "query1", + "data_source": "metrics", + "query": "avg:example.job.duration{env:prod} by {job}" + } + ] + } +} +``` + +Replace `example.job.duration` with your metric. + +In this example: + +- The monitor enters `ALERT` when the current average duration exceeds 150% of the historical weekly average. +- The monitor recovers when the current average falls to or below 120% of the historical weekly average. +- Each job has its own calculated threshold. + +See the [Monitors API][2] for additional configuration options. + +## Limitations + +Relative thresholds have the following restrictions: + +| Restriction | Description | +|---|---| +| Monitor types | Supported for metric monitors using Formulas and Functions queries. | +| Historical window | Must be between 1 week and 6 months and at least as long as the monitor's evaluation window. | +| Threshold types | Supports critical threshold queries and critical recovery threshold queries. Relative warning thresholds are not supported in this Preview. | +| Static thresholds | Relative and static thresholds cannot be combined in the same monitor. | +| Query result | The threshold query must produce a numeric threshold for each matching group that can be compared with the current evaluated value. | +| Historical data | Sufficient historical data must be available to calculate the threshold for a group. | +| Update frequency | Historical thresholds are recalculated daily rather than on every monitor evaluation. | + +The monitor and historical queries must produce compatible results for comparison. If Datadog cannot calculate a historical threshold for a group, the monitor cannot perform the comparison for that group. For example, a group might have no matching historical data. + +When historical data is unavailable, the monitor's [missing-data behavior][3] determines how the absence of an evaluable result is handled. + +## When to use relative thresholds + +Use relative thresholds to detect a meaningful change from an established baseline. The expected change should be expressible as a ratio. + +### Detect gradual performance degradation + +Monitor metrics such as request latency, processing duration, or queue processing time. + +For example, alert when a job's execution time is 50% higher than its historical average. This allows you to detect regressions even if different jobs have different execution times. + +### Monitor resources with different baselines + +Monitor a fleet of services or hosts without choosing individual thresholds for each resource. + +For example, one service might normally consume 10% CPU while another consumes 60%. A relative threshold can identify increases from each service's normal behavior using a single grouped monitor. + +### Detect changes in workloads that grow over time + +Monitor metrics where the expected value increases or decreases gradually as a business or service evolves. + +For example, alert when the duration of a regularly scheduled data processing job increases significantly compared to its historical average. + +Because the threshold adapts over time, you don't need to repeatedly adjust a static threshold as normal operating conditions change. + +## When not to use relative thresholds + +Relative thresholds are not appropriate for every monitoring scenario. + +### When there is a known absolute limit + +If a metric has a clear failure boundary, use a static threshold. + +For example, alerting when disk usage exceeds 90% is usually more appropriate than alerting when disk usage is 50% higher than its historical average. + +A relative threshold can rise alongside sustained degradation, potentially allowing an unhealthy value to become part of the baseline. + +### When the historical baseline is near zero + +Relative comparisons can be misleading when historical values are zero or small. + +For example, increasing from one error per hour to three errors per hour is a 200% increase, but might not represent a meaningful incident. + +Consider using an absolute threshold when small changes in low-volume metrics should not trigger alerts. + +### When data has strong daily or weekly seasonality + +Relative thresholds aggregate historical data over a longer period rather than modeling expected behavior for a particular time of day or day of week. + +For example, request volume might consistently be lower overnight than during business hours. Comparing overnight traffic against an entire week's average could produce unwanted alerts. + +For metrics with strong recurring patterns, consider an [anomaly detection monitor][4] or a [change alert][5]. + +### When groups are short-lived or data is extremely sparse + +Relative thresholds require sufficient historical data to calculate a meaningful baseline. + +New services, temporary resources, or infrequently reporting metrics might not have enough historical observations. This can prevent evaluation or produce baselines that do not accurately represent normal behavior. + +For these cases, consider a static threshold or a monitor designed around the expected frequency of the data. + +### When you need immediate adaptation + +Historical thresholds update daily and are intended to detect deviations from longer-term behavior. + +If the expected range needs to adapt continuously to changing conditions, consider another detection method, such as anomaly detection. + +## Further reading + +{{< partial name="whats-next/whats-next.html" >}} + +[1]: /monitors/types/metric/ +[2]: /api/latest/monitors/#create-a-monitor +[3]: /monitors/configuration/?tab=thresholdalert#no-data +[4]: /monitors/types/anomaly/ +[5]: /monitors/types/change-alert/ diff --git a/hugo/content/en/monitors/types/metric.md b/hugo/content/en/monitors/types/metric.md index afec78541d01..fa0fbba0a506 100644 --- a/hugo/content/en/monitors/types/metric.md +++ b/hugo/content/en/monitors/types/metric.md @@ -44,7 +44,7 @@ Relative thresholds are in Preview. For examples and Preview limitations, see [Relative thresholds][2]. [1]: /metrics/distributions/ -[2]: /monitors/guide/non_static_thresholds/#relative-thresholds +[2]: /monitors/guide/relative-thresholds/ {{% /tab %}} {{% tab "Change" %}} From 60efd84e934b857046824efaeff69083897f1ed2 Mon Sep 17 00:00:00 2001 From: datadog-bits <263423550+datadog-bits@users.noreply.github.com> Date: Fri, 13 Nov 2026 19:07:38 +0000 Subject: [PATCH 3/5] Use multipliers in relative threshold docs Co-authored-by: phillip-dd <59581508+phillip-dd@users.noreply.github.com> --- .../en/monitors/configuration/_index.md | 4 +- .../monitors/guide/non_static_thresholds.md | 6 +-- .../en/monitors/guide/relative-thresholds.md | 46 ++++++------------- hugo/content/en/monitors/types/metric.md | 2 +- 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/hugo/content/en/monitors/configuration/_index.md b/hugo/content/en/monitors/configuration/_index.md index dd2f3ea889aa..a1630cd37f83 100644 --- a/hugo/content/en/monitors/configuration/_index.md +++ b/hugo/content/en/monitors/configuration/_index.md @@ -162,7 +162,7 @@ As you change a threshold, the preview graph in the editor displays a marker sho #### Relative thresholds {{< callout url="#" btn_hidden="true" header="Preview" >}} -Relative thresholds, also called dynamic thresholds, are in Preview for metric monitors. +Relative thresholds are in Preview for metric monitors. {{< /callout >}} A relative threshold uses historical data from the same monitor query as its baseline. Datadog applies an optional multiplier to the aggregated baseline to calculate the threshold. For monitors grouped by tags, each group has its own baseline and threshold. @@ -171,7 +171,7 @@ To configure a relative threshold in **Set alert conditions**: 1. Select a relative threshold and choose the alert direction. 2. Select a historical aggregation and a lookback window from 1 week to 6 months. The historical window must be at least as long as the monitor's evaluation window. -3. Set the multiplier and, optionally, a critical recovery threshold. For example, alert above 150% of the historical average and recover at or below 120% of that average. +3. Set the multiplier and, optionally, a critical recovery threshold. For example, alert above `1.5x` the historical average and recover at or below `1.2x` that average. Historical thresholds are recalculated daily at midnight UTC and remain constant between updates. The monitor's evaluation frequency continues to control how often Datadog compares current values to those thresholds. diff --git a/hugo/content/en/monitors/guide/non_static_thresholds.md b/hugo/content/en/monitors/guide/non_static_thresholds.md index 021d622a6682..d1b43ddf7705 100644 --- a/hugo/content/en/monitors/guide/non_static_thresholds.md +++ b/hugo/content/en/monitors/guide/non_static_thresholds.md @@ -24,19 +24,17 @@ Choose an approach based on the comparison you need: ## Relative thresholds {{< callout url="#" btn_hidden="true" header="Preview" >}} -Relative thresholds, also called dynamic thresholds, are in Preview for metric monitors. +Relative thresholds are in Preview for metric monitors. {{< /callout >}} A relative threshold compares the evaluated value of a metric monitor to a historical baseline from the same query. Datadog calculates a separate threshold for each group, so one monitor can cover resources with different normal values. -For example, alert when the average job duration over five minutes exceeds 150% of its average over the last week. A threshold of 150% of the baseline means 50% above the baseline, not a 150% increase. +For example, alert when the average job duration over five minutes exceeds `1.5x` its average over the last week. Choose a historical aggregation and a lookback window from 1 week to 6 months. Historical thresholds are recalculated daily at midnight UTC and remain constant between updates. The monitor continues evaluating current values at its configured evaluation frequency. For configuration steps, query syntax, critical recovery thresholds, and Preview limitations, see the [Relative Thresholds guide][6]. -Use a relative threshold to detect a known degree of change from a historical level. For a comparison to the same time in a previous week, use the [seasonal threshold example](#seasonal-threshold). For a comparison to a different metric, use the [reference threshold example](#reference-threshold). - ## Seasonal threshold ### Context diff --git a/hugo/content/en/monitors/guide/relative-thresholds.md b/hugo/content/en/monitors/guide/relative-thresholds.md index 038343bd8d8b..c4eb6bca7112 100644 --- a/hugo/content/en/monitors/guide/relative-thresholds.md +++ b/hugo/content/en/monitors/guide/relative-thresholds.md @@ -1,33 +1,17 @@ --- title: Relative Thresholds description: "Configure relative thresholds (Preview) to compare metric values with historical baselines, including query syntax, recovery thresholds, and limitations." -further_reading: -- link: "/monitors/types/metric/" - tag: "Documentation" - text: "Metric Monitors" -- link: "/monitors/configuration/" - tag: "Documentation" - text: "Configure Monitors" -- link: "/monitors/types/anomaly/" - tag: "Documentation" - text: "Anomaly Detection Monitors" -- link: "/monitors/guide/non_static_thresholds/" - tag: "Documentation" - text: "How to Monitor Non-Static Thresholds" -- link: "/api/latest/monitors/" - tag: "API" - text: "Monitors API" --- ## Overview {{< callout url="#" btn_hidden="true" header="Preview" >}} -Relative thresholds, also called dynamic thresholds, are in Preview and are available for metric monitors. +Relative thresholds are in Preview and are available for metric monitors. {{< /callout >}} Relative thresholds let you alert when a metric deviates from its historical behavior, without choosing a fixed threshold. -Instead of alerting when a metric exceeds a specific value, such as 100 ms, alert when it exceeds a percentage of its historical baseline. For example, alert when a metric exceeds 150% of its average over the past week. +Instead of alerting when a metric exceeds a specific value, such as 100 ms, alert when it exceeds a multiple of its historical baseline. For example, alert when a metric exceeds `1.5x` its average over the past week. Relative thresholds are useful for metrics whose normal values vary between services, hosts, or other groups, or gradually change over time. They provide an alternative to static thresholds and anomaly detection when you want to detect a known degree of change. @@ -40,7 +24,7 @@ A relative threshold compares two values: For example, configure a monitor to alert when: -`Average over the last 5 minutes > 1.5 × Average over the last week` +`Average over the last 5 minutes > 1.5x the average over the last week` If a service's historical average request latency is 200 ms, its alert threshold is 300 ms. If the historical average later increases to 250 ms, its alert threshold becomes 375 ms. @@ -64,9 +48,9 @@ For example, a monitor grouped by `service` might have the following values: | Service | Historical average | Multiplier | Alert threshold | |---|---:|---:|---:| -| Service A | 100 ms | 1.5 | 150 ms | -| Service B | 400 ms | 1.5 | 600 ms | -| Service C | 800 ms | 1.5 | 1200 ms | +| Service A | 100 ms | `1.5x` | 150 ms | +| Service B | 400 ms | `1.5x` | 600 ms | +| Service C | 800 ms | `1.5x` | 1200 ms | Each service is evaluated independently against its own threshold. @@ -84,7 +68,7 @@ To configure a relative threshold: 6. Configure the alert direction and, optionally, a recovery threshold. 7. Review the resulting thresholds and monitor behavior before saving. -For an alert configured to trigger above the threshold, a multiplier of `1.5` triggers when the current value exceeds 150% of its historical baseline. A multiplier of `0.7` can detect a drop below 70% of the baseline when the alert direction is below the threshold. +For example, set the alert threshold to `1.5x` the historical baseline to detect an increase. Set it to `0.7x` and choose the below direction to detect a drop. ### Query syntax @@ -113,11 +97,11 @@ formula("").rollup("").last("").multiplier(}} - [1]: /monitors/types/metric/ [2]: /api/latest/monitors/#create-a-monitor [3]: /monitors/configuration/?tab=thresholdalert#no-data diff --git a/hugo/content/en/monitors/types/metric.md b/hugo/content/en/monitors/types/metric.md index fa0fbba0a506..24c2052304dc 100644 --- a/hugo/content/en/monitors/types/metric.md +++ b/hugo/content/en/monitors/types/metric.md @@ -31,7 +31,7 @@ To create a metric monitor in Datadog, navigate to [{{< ui >}}Monitors{{< /ui >} {{< tabs >}} {{% tab "Threshold" %}} -A threshold alert compares metric values to a static threshold or a relative threshold (Preview). A static threshold is a fixed number. A relative threshold, also called a dynamic threshold, adapts to a historical baseline from the same query. +A threshold alert compares metric values to a static threshold or a relative threshold (Preview). A static threshold is a fixed number. A relative threshold adapts to a historical baseline from the same query. On each alert evaluation, Datadog calculates the average, minimum, maximum, or sum over the selected period and checks if it is above, below, equal to, or not equal to the threshold. This is for standard alert cases where you know the expected values. The [distribution metric type][1] offers the additional threshold option of calculating percentiles over the selected period. From 16fea31c8212b3b1dbb3a8d45dc9975d718c5c47 Mon Sep 17 00:00:00 2001 From: datadog-bits <263423550+datadog-bits@users.noreply.github.com> Date: Fri, 20 Nov 2026 19:16:23 +0000 Subject: [PATCH 4/5] Clarify percentiles in relative thresholds Co-authored-by: phillip-dd <59581508+phillip-dd@users.noreply.github.com> --- .../en/monitors/configuration/_index.md | 3 + .../monitors/guide/non_static_thresholds.md | 3 + .../en/monitors/guide/relative-thresholds.md | 108 +++++++++++++++++- hugo/content/en/monitors/types/metric.md | 2 +- 4 files changed, 113 insertions(+), 3 deletions(-) diff --git a/hugo/content/en/monitors/configuration/_index.md b/hugo/content/en/monitors/configuration/_index.md index a1630cd37f83..a733bc642d77 100644 --- a/hugo/content/en/monitors/configuration/_index.md +++ b/hugo/content/en/monitors/configuration/_index.md @@ -173,6 +173,8 @@ To configure a relative threshold in **Set alert conditions**: 2. Select a historical aggregation and a lookback window from 1 week to 6 months. The historical window must be at least as long as the monitor's evaluation window. 3. Set the multiplier and, optionally, a critical recovery threshold. For example, alert above `1.5x` the historical average and recover at or below `1.2x` that average. +The evaluation and historical aggregations can differ, including percentile and average aggregations for distribution metrics. With a `p95:` metric variable, `.rollup("percentile")` calculates the p95 across the window's distribution data, while `.rollup("avg")` averages the p95 timeseries values. See [Percentile queries][8] for examples. + Historical thresholds are recalculated daily at midnight UTC and remain constant between updates. The monitor's evaluation frequency continues to control how often Datadog compares current values to those thresholds. Relative thresholds support critical threshold queries and critical recovery threshold queries. Relative warning thresholds are not supported in Preview, and static and relative thresholds cannot be combined in the same monitor. @@ -186,6 +188,7 @@ For configuration examples, query syntax, and limitations, see the [Relative Thr [5]: /monitors/guide/recovery-thresholds/ [6]: /monitors/types/log/ [7]: /monitors/guide/relative-thresholds/ +[8]: /monitors/guide/relative-thresholds/#percentile-queries {{% /tab %}} {{% tab "Check alert" %}} diff --git a/hugo/content/en/monitors/guide/non_static_thresholds.md b/hugo/content/en/monitors/guide/non_static_thresholds.md index d1b43ddf7705..32cfd24e8356 100644 --- a/hugo/content/en/monitors/guide/non_static_thresholds.md +++ b/hugo/content/en/monitors/guide/non_static_thresholds.md @@ -31,6 +31,8 @@ A relative threshold compares the evaluated value of a metric monitor to a histo For example, alert when the average job duration over five minutes exceeds `1.5x` its average over the last week. +The current value and historical baseline can use different aggregations. For distribution metrics, compare a percentile to a historical percentile or to a historical average. With a `p95:` metric variable, an `avg` rollup averages the p95 timeseries values. See [Percentile queries][7] for all three comparison examples. + Choose a historical aggregation and a lookback window from 1 week to 6 months. Historical thresholds are recalculated daily at midnight UTC and remain constant between updates. The monitor continues evaluating current values at its configured evaluation frequency. For configuration steps, query syntax, critical recovery thresholds, and Preview limitations, see the [Relative Thresholds guide][6]. @@ -203,3 +205,4 @@ The last monitor is a Composite monitor, which sends an alert only if the two pr [4]: /account_management/billing/usage_metrics/#types-of-usage [5]: /logs/log_configuration/logs_to_metrics/#logs-usage-metrics [6]: /monitors/guide/relative-thresholds/ +[7]: /monitors/guide/relative-thresholds/#percentile-queries diff --git a/hugo/content/en/monitors/guide/relative-thresholds.md b/hugo/content/en/monitors/guide/relative-thresholds.md index c4eb6bca7112..b5225c42cde1 100644 --- a/hugo/content/en/monitors/guide/relative-thresholds.md +++ b/hugo/content/en/monitors/guide/relative-thresholds.md @@ -1,6 +1,6 @@ --- title: Relative Thresholds -description: "Configure relative thresholds (Preview) to compare metric values with historical baselines, including query syntax, recovery thresholds, and limitations." +description: "Configure relative thresholds (Preview) to compare metric values with historical baselines, including percentile queries, recovery thresholds, and limitations." --- ## Overview @@ -93,7 +93,7 @@ formula("").rollup("").last("").multiplier(}} +{{% tab "Percentile vs. percentile" %}} + +Alert when the p95 request duration over five minutes exceeds `1.5x` the historical weekly p95. + +```json +{ + "name": "Request duration p95 above historical p95", + "type": "query alert", + "query": "formula(\"query1\").rollup(\"percentile\").last(\"5m\") > threshold", + "message": "Request duration p95 is above its historical baseline.", + "options": { + "thresholds": { + "critical_query": "formula(\"query1\").rollup(\"percentile\").last(\"1w\").multiplier(1.5)" + }, + "variables": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p95:example.request.duration{env:prod} by {service}" + } + ] + } +} +``` + +{{% /tab %}} +{{% tab "Percentile vs. average" %}} + +Alert when the p95 request duration over five minutes exceeds `1.5x` the average of the p95 timeseries values over the last week. + +```json +{ + "name": "Request duration p95 above historical average of p95", + "type": "query alert", + "query": "formula(\"query1\").rollup(\"percentile\").last(\"5m\") > threshold", + "message": "Request duration p95 is above its historical baseline.", + "options": { + "thresholds": { + "critical_query": "formula(\"query1\").rollup(\"avg\").last(\"1w\").multiplier(1.5)" + }, + "variables": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p95:example.request.duration{env:prod} by {service}" + } + ] + } +} +``` + +{{% /tab %}} +{{% tab "Average vs. percentile" %}} + +Alert when the average of the p95 request-duration timeseries values over five minutes exceeds `1.5x` the historical weekly p95. + +```json +{ + "name": "Average request duration p95 above historical p95", + "type": "query alert", + "query": "formula(\"query1\").rollup(\"avg\").last(\"5m\") > threshold", + "message": "Average request duration p95 is above its historical baseline.", + "options": { + "thresholds": { + "critical_query": "formula(\"query1\").rollup(\"percentile\").last(\"1w\").multiplier(1.5)" + }, + "variables": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p95:example.request.duration{env:prod} by {service}" + } + ] + } +} +``` + +{{% /tab %}} +{{< /tabs >}} + ## Limitations Relative thresholds have the following restrictions: @@ -224,3 +327,4 @@ If the expected range needs to adapt continuously to changing conditions, consid [3]: /monitors/configuration/?tab=thresholdalert#no-data [4]: /monitors/types/anomaly/ [5]: /monitors/types/change-alert/ +[6]: /metrics/distributions/#enabling-advanced-query-functionality diff --git a/hugo/content/en/monitors/types/metric.md b/hugo/content/en/monitors/types/metric.md index 24c2052304dc..529bff09d4e9 100644 --- a/hugo/content/en/monitors/types/metric.md +++ b/hugo/content/en/monitors/types/metric.md @@ -41,7 +41,7 @@ For more information, see the [Set alert conditions](#set-alert-conditions) sect Relative thresholds are in Preview. {{< /callout >}} -For examples and Preview limitations, see [Relative thresholds][2]. +Relative thresholds can use different aggregations for the evaluation and historical windows, including percentile aggregations for distribution metrics. For examples and Preview limitations, see [Relative thresholds][2]. [1]: /metrics/distributions/ [2]: /monitors/guide/relative-thresholds/ From 7781899450a7a46eb3a3cabe35d30e76d649a79e Mon Sep 17 00:00:00 2001 From: datadog-bits <263423550+datadog-bits@users.noreply.github.com> Date: Mon, 23 Nov 2026 01:29:07 +0000 Subject: [PATCH 5/5] Clarify relative threshold configuration steps Co-authored-by: phillip-dd <59581508+phillip-dd@users.noreply.github.com> --- hugo/content/en/monitors/guide/relative-thresholds.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hugo/content/en/monitors/guide/relative-thresholds.md b/hugo/content/en/monitors/guide/relative-thresholds.md index b5225c42cde1..db01de6de90e 100644 --- a/hugo/content/en/monitors/guide/relative-thresholds.md +++ b/hugo/content/en/monitors/guide/relative-thresholds.md @@ -63,9 +63,9 @@ To configure a relative threshold: 1. Create or edit a [metric monitor][1]. 2. Define the metric and its evaluation window. 3. In the alert conditions, select a relative threshold. -4. Select the historical aggregation and lookback window. -5. Set a multiplier that determines how much the current value can deviate from the historical baseline. -6. Configure the alert direction and, optionally, a recovery threshold. +4. Select the threshold aggregation and lookback window. +5. Set a multiplier that determines how much the current value can deviate from the historical baseline. This can be smaller than one (less than the baseline) or larger than one (greater than the baseline). +6. Optionally, configure a recovery threshold. 7. Review the resulting thresholds and monitor behavior before saving. For example, set the alert threshold to `1.5x` the historical baseline to detect an increase. Set it to `0.7x` and choose the below direction to detect a drop. @@ -99,6 +99,8 @@ formula("").rollup("").last("").multiplier(