From 02206564df7ff0dfe6368b36017b7f7a487736d0 Mon Sep 17 00:00:00 2001 From: Alicia Thuerk Date: Tue, 6 Jan 2026 15:16:16 -0700 Subject: [PATCH 1/6] update examples --- .../notifications/conditional_alerting.md | 49 ++++++++++++++----- .../notifications/template_variables.md | 7 ++- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/content/en/synthetics/notifications/conditional_alerting.md b/content/en/synthetics/notifications/conditional_alerting.md index 16bdbd89e65..9f6ef57b71f 100644 --- a/content/en/synthetics/notifications/conditional_alerting.md +++ b/content/en/synthetics/notifications/conditional_alerting.md @@ -24,11 +24,11 @@ To ensure notifications are delivered properly, always include a notification ha For more detailed information, see the Monitor documentation. -### Examples +## Examples -**Send alerts based on status code:** +### Send alerts based on status code -```handlebars +```shell {{! If a test triggers an alert for an API test and returns a 500 statuscode, notify the backend team. }} @@ -37,13 +37,36 @@ If a test triggers an alert for an API test and returns a 500 statuscode, notify {{/is_alert}} ``` -**Send alerts to a specific Slack channel based on failed step:** +### Send alerts based on an error code +```shell +{{! +Use multiple is_exact_match conditions to display specific failure codes in your notification. +This example checks for DNS and INCORRECT_ASSERTION failure codes +}} + +{{#if synthetics.attributes.result.failure}} + +{{#is_exact_match "synthetics.attributes.result.failure.code" "DNS"}} +print out failure code: The failure code is DNS +{{/is_exact_match}} + +{{#is_exact_match "synthetics.attributes.result.failure.code" "INCORRECT_ASSERTION"}} +print out failure code: The failure code is an INCORRECT ASSERTION +{{/is_exact_match}} + +{{/if}} +``` -```handlebars +For a complete list of API test error codes, see [API Testing Errors][1]. + +### Send alerts to a specific Slack channel based on failed step + +```shell {{! If a test triggers an alert for browser or mobile tests, loop through each step and find the failed step. If the failed step's description field matches Checkout, notify the recipient }} + {{#is_alert}} {{#each synthetics.attributes.result.steps}} {{#is_match "status" "failed"}} @@ -55,24 +78,26 @@ If the failed step's description field matches Checkout, notify the recipient **Send alerts to a specific Slack channel based on failed step using a variable shortcut:** -```handlebars +```shell {{! This alert uses the `{{synthetics.failed_step}}` object which is a variable shortcut that points to the relevant step data contained in `{{synthetics.attributes.result.steps}}`. If the test triggers an alert for browser or mobile tests, and if the failed step's description field matches Checkout, notify the recipient. }} + {{#is_alert}} {{#is_match "synthetics.failed_step.description" "Checkout"}}@notify-slack-payments{{/is_match}} {{/is_alert}} ``` -**Set different alert priorities:** +### Set different alert priorities -```handlebars +```shell {{! If a test triggers an alert for a multistep API test, loop through each step and find the failed step. If the step's name matches the staging domain, set the priority to P2. Otherwise, set it to P4. }} -{{#is_alert}}send a message to thang @thang.nguyen@datadoghq.com + +{{#is_alert}}send a message to @example@email.com {{#each synthetics.attributes.result.steps}} {{#is_match "status" "failed"}} {{#is_match "name" "stagedomain"}}Stage domain failed. Overriding priority to P2. @@ -84,9 +109,9 @@ If the step's name matches the staging domain, set the priority to P2. Otherwise {{/is_alert}} ``` -**Set different alert priorities using variable shortcut:** +### Set different alert priorities using variable shortcut -```handlebars +```shell {{! This alert uses the `{{synthetics.failed_step}}` object which is a variable shortcut that points to the relevant step data contained in `{{synthetics.attributes.result.steps}}`. If the test triggers an alert for multistep API test and if the failed step's name field matches the domain, override the priority. @@ -101,3 +126,5 @@ If the test triggers an alert for multistep API test and if the failed step's na ## Further Reading {{< partial name="whats-next/whats-next.html" >}} + +[1]: /synthetics/api_tests/errors diff --git a/content/en/synthetics/notifications/template_variables.md b/content/en/synthetics/notifications/template_variables.md index 0a37d38d965..29b6cea9953 100644 --- a/content/en/synthetics/notifications/template_variables.md +++ b/content/en/synthetics/notifications/template_variables.md @@ -103,7 +103,7 @@ Applies to browser and mobile tests. : Epoch timestamps in milliseconds `{{synthetics.attributes.result.failure}}` -: The `failure` object contains information about why the test failed +: The `failure` object contains information about why the test failed `{{synthetics.attributes.result.failure.message}}` : The failure message @@ -111,6 +111,8 @@ Applies to browser and mobile tests. `{{synthetics.attributes.result.failure.code}}` : The failure code +Review the [conditional alerting][2] page for an example of how to use this variable in a notification. + {{% /tab %}} {{% tab "Count" %}} @@ -574,4 +576,5 @@ Combine any reference method with a property: {{< partial name="whats-next/whats-next.html" >}} -[1]: /synthetics/explore/results_explorer \ No newline at end of file +[1]: /synthetics/explore/results_explorer +[2]: /synthetics/notifications/conditional_alerting/#send-alerts-based-on-an-error-code \ No newline at end of file From f00475d742d0e4d4909058a84fde0d3056caf9eb Mon Sep 17 00:00:00 2001 From: Alicia Thuerk Date: Tue, 6 Jan 2026 15:40:00 -0700 Subject: [PATCH 2/6] adding paragraph tags to fix links --- content/en/synthetics/notifications/template_variables.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/en/synthetics/notifications/template_variables.md b/content/en/synthetics/notifications/template_variables.md index 70df2b07aab..0658a64c784 100644 --- a/content/en/synthetics/notifications/template_variables.md +++ b/content/en/synthetics/notifications/template_variables.md @@ -149,7 +149,7 @@ Applies to Browser and Mobile tests. `{{synthetics.attributes.result.failure.code}}` : The failure code -Review the [conditional alerting][2] page for an example of how to use this variable in a notification. +

For a complete list of API test error codes, see API Testing Errors. Review the conditional alerting page for an example of how to use the synthetics.attributes.result.failure variable in a notification.

{{% /tab %}} {{% tab "Count" %}} @@ -639,4 +639,6 @@ Combine any reference method with a property: [1]: /synthetics/explore/results_explorer [2]: /synthetics/notifications/template_variables/?tab=apitests#step-execution-details +[3]: /synthetics/notifications/conditional_alerting#send-alerts-based-on-an-error-code +[4]: /synthetics/api_tests/errors/ From 9e8922c38082556c0df0d766f9a49a37a1050e13 Mon Sep 17 00:00:00 2001 From: Alicia Thuerk Date: Tue, 6 Jan 2026 17:02:23 -0700 Subject: [PATCH 3/6] adding more reference links to conditional page --- .../synthetics/notifications/conditional_alerting.md | 7 ++++--- .../synthetics/notifications/template_variables.md | 12 +++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/content/en/synthetics/notifications/conditional_alerting.md b/content/en/synthetics/notifications/conditional_alerting.md index 9f6ef57b71f..c9fd940a99c 100644 --- a/content/en/synthetics/notifications/conditional_alerting.md +++ b/content/en/synthetics/notifications/conditional_alerting.md @@ -38,6 +38,7 @@ If a test triggers an alert for an API test and returns a 500 statuscode, notify ``` ### Send alerts based on an error code + ```shell {{! Use multiple is_exact_match conditions to display specific failure codes in your notification. @@ -76,11 +77,11 @@ If the failed step's description field matches Checkout, notify the recipient {{/is_alert}} ``` -**Send alerts to a specific Slack channel based on failed step using a variable shortcut:** +### Send alerts to a specific Slack channel based on failed step using a variable shortcut ```shell {{! -This alert uses the `{{synthetics.failed_step}}` object which is a variable shortcut that points to the relevant step data contained in `{{synthetics.attributes.result.steps}}`. +This alert uses the {{synthetics.failed_step}} object which is a variable shortcut that points to the relevant step data contained in {{synthetics.attributes.result.steps}}. If the test triggers an alert for browser or mobile tests, and if the failed step's description field matches Checkout, notify the recipient. }} @@ -113,7 +114,7 @@ If the step's name matches the staging domain, set the priority to P2. Otherwise ```shell {{! -This alert uses the `{{synthetics.failed_step}}` object which is a variable shortcut that points to the relevant step data contained in `{{synthetics.attributes.result.steps}}`. +This alert uses the {{synthetics.failed_step}} object which is a variable shortcut that points to the relevant step data contained in `{{synthetics.attributes.result.steps}}`. If the test triggers an alert for multistep API test and if the failed step's name field matches the domain, override the priority. }} {{#is_alert}} diff --git a/content/en/synthetics/notifications/template_variables.md b/content/en/synthetics/notifications/template_variables.md index 0658a64c784..53d3ed05672 100644 --- a/content/en/synthetics/notifications/template_variables.md +++ b/content/en/synthetics/notifications/template_variables.md @@ -57,6 +57,8 @@ Use these variables to access common test execution data such as failure message : Lists all the tags added to the synthetics test. : To access individual tag values, use `{{tags.}}`. For example, if your test is tagged with `env:prod`, use `{{tags.env}}` to return the tag value `prod`. +

Review the conditional alerting page for an example of how to use the synthetics.attributes.result.response.statusCode variable in a notification.

+ ### Result attributes Path: `synthetics.attributes` @@ -179,7 +181,11 @@ Applies to Multistep, Browser, and Mobile tests. `{{synthetics.failed_step}}` : The `failed_step` object provides a shortcut to the step that caused the test to fail, eliminating the need to reference `{{synthetics.attributes.result.steps.}}` directly. -For example, `{{synthetics.failed_step.name}}` maps to `{{synthetics.attributes.result.steps..name}}` for Multistep API tests, and to `{{synthetics.attributes.result.steps..description}}` for Browser and Mobile tests. +For example, `{{synthetics.failed_step.name}}` maps to `{{synthetics.attributes.result.steps..name}}` for Multistep API tests, and to `synthetics.failed_step.description` maps to`{{synthetics.attributes.result.steps..description}}` for Browser and Mobile tests. + +Review the [conditional alerting][1] page for an example of how to use the `synthetics.failed_step.description` shortcut variable in Browser Test notification. + +[1]: /synthetics/notifications/conditional_alerting/#send-alerts-to-a-specific-slack-channel-based-on-failed-step-using-a-variable-shortcut {{% /tab %}} {{< /tabs >}} @@ -625,6 +631,8 @@ Use the step's unique identifier: `.steps.abc-def-ghi` +Review the [conditional alerting][6] page for an example of how to use the `synthetics.attributes.result.step` variable in a slack notification based on a failed step. + #### Accessing step properties Combine any reference method with a property: @@ -641,4 +649,6 @@ Combine any reference method with a property: [2]: /synthetics/notifications/template_variables/?tab=apitests#step-execution-details [3]: /synthetics/notifications/conditional_alerting#send-alerts-based-on-an-error-code [4]: /synthetics/api_tests/errors/ +[5]: /synthetics/notifications/conditional_alerting#send-alerts-based-on-status-code +[6]: /synthetics/notifications/conditional_alerting#send-alerts-to-a-specific-slack-channel-based-on-failed-step From 85a54f5577a939670a6a317f791a8a89339a0eef Mon Sep 17 00:00:00 2001 From: Alicia Thuerk Date: Tue, 6 Jan 2026 20:43:21 -0700 Subject: [PATCH 4/6] clean up/formatting --- .../notifications/template_variables.md | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/content/en/synthetics/notifications/template_variables.md b/content/en/synthetics/notifications/template_variables.md index 53d3ed05672..89fb4464810 100644 --- a/content/en/synthetics/notifications/template_variables.md +++ b/content/en/synthetics/notifications/template_variables.md @@ -45,7 +45,8 @@ Use these variables to access common test execution data such as failure message : The URL of the failed step (for example, `https://www.datadoghq.com/blog/`). `{{synthetics.attributes.result.response.statusCode}}` -: The HTTP status code (for example, `403`). +: The HTTP status code (for example, `403`).
+Tip: Review the conditional alerting page for an example of how to use this variable in a notification. `{{synthetics.result.step_count}}` : Number of steps (for example, `4`). @@ -57,8 +58,6 @@ Use these variables to access common test execution data such as failure message : Lists all the tags added to the synthetics test. : To access individual tag values, use `{{tags.}}`. For example, if your test is tagged with `env:prod`, use `{{tags.env}}` to return the tag value `prod`. -

Review the conditional alerting page for an example of how to use the synthetics.attributes.result.response.statusCode variable in a notification.

- ### Result attributes Path: `synthetics.attributes` @@ -179,13 +178,31 @@ Applies to Multistep, Browser, and Mobile tests. Applies to Multistep, Browser, and Mobile tests. `{{synthetics.failed_step}}` -: The `failed_step` object provides a shortcut to the step that caused the test to fail, eliminating the need to reference `{{synthetics.attributes.result.steps.}}` directly. - -For example, `{{synthetics.failed_step.name}}` maps to `{{synthetics.attributes.result.steps..name}}` for Multistep API tests, and to `synthetics.failed_step.description` maps to`{{synthetics.attributes.result.steps..description}}` for Browser and Mobile tests. - -Review the [conditional alerting][1] page for an example of how to use the `synthetics.failed_step.description` shortcut variable in Browser Test notification. - -[1]: /synthetics/notifications/conditional_alerting/#send-alerts-to-a-specific-slack-channel-based-on-failed-step-using-a-variable-shortcut +: The `failed_step` object provides a shortcut to the step that caused the test to fail, eliminating the need to reference `{{synthetics.attributes.result.steps.}}` directly.
+ + + + + + + + + + + + + + + + + + + + + +
ShortcutTest TypeMaps To
{{synthetics.failed_step.name}}Multistep API{{synthetics.attributes.result.steps.<step-index>.name}}
{{synthetics.failed_step.description}}Browser, Mobile{{synthetics.attributes.result.steps.<step-index>.description}}
+ +
Review the conditional alerting page for an example of how to use the synthetics.failed_step.description shortcut variable in a Browser Test notification.
{{% /tab %}} {{< /tabs >}} @@ -631,7 +648,7 @@ Use the step's unique identifier: `.steps.abc-def-ghi` -Review the [conditional alerting][6] page for an example of how to use the `synthetics.attributes.result.step` variable in a slack notification based on a failed step. +
Review the conditional alerting page for an example of how to use the synthetics.attributes.result.step variable in a Slack notification based on a failed step.
#### Accessing step properties From 9685ada40af667266f56f5ddbf76f3cda4783671 Mon Sep 17 00:00:00 2001 From: Alicia Thuerk Date: Tue, 6 Jan 2026 21:02:09 -0700 Subject: [PATCH 5/6] convert sentence to callout --- content/en/synthetics/notifications/conditional_alerting.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/en/synthetics/notifications/conditional_alerting.md b/content/en/synthetics/notifications/conditional_alerting.md index c9fd940a99c..b7e6d7b68f5 100644 --- a/content/en/synthetics/notifications/conditional_alerting.md +++ b/content/en/synthetics/notifications/conditional_alerting.md @@ -58,7 +58,7 @@ print out failure code: The failure code is an INCORRECT ASSERTION {{/if}} ``` -For a complete list of API test error codes, see [API Testing Errors][1]. +
For a complete list of API test error codes, see API Testing Errors.
### Send alerts to a specific Slack channel based on failed step @@ -127,5 +127,3 @@ If the test triggers an alert for multistep API test and if the failed step's na ## Further Reading {{< partial name="whats-next/whats-next.html" >}} - -[1]: /synthetics/api_tests/errors From 0fa15b895f39fbd6c3de9b1b5ef6b1df8a372317 Mon Sep 17 00:00:00 2001 From: Alicia Thuerk Date: Wed, 7 Jan 2026 09:34:36 -0700 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: May Lee --- content/en/synthetics/notifications/template_variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/synthetics/notifications/template_variables.md b/content/en/synthetics/notifications/template_variables.md index 89fb4464810..4ba44e7b1bf 100644 --- a/content/en/synthetics/notifications/template_variables.md +++ b/content/en/synthetics/notifications/template_variables.md @@ -142,7 +142,7 @@ Applies to Browser and Mobile tests. : Epoch timestamps in milliseconds `{{synthetics.attributes.result.failure}}` -: The `failure` object contains information about why the test failed +: The `failure` object contains information about why the test failed `{{synthetics.attributes.result.failure.message}}` : The failure message