-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[DOCS-12977] cleanup of Synthetics Notifications #33695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0220656
update examples
git-thuerk-done 3381e69
Merge branch 'master' into aliciathuerk/update-api-failure
git-thuerk-done f00475d
adding paragraph tags to fix links
git-thuerk-done 9e8922c
adding more reference links to conditional page
git-thuerk-done 85a54f5
clean up/formatting
git-thuerk-done 9685ada
convert sentence to callout
git-thuerk-done 0fa15b8
Apply suggestions from code review
git-thuerk-done File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,11 +24,11 @@ To ensure notifications are delivered properly, always include a notification ha | |
|
|
||
| For more detailed information, see the <a href="https://docs.datadoghq.com/monitors/notify/variables/?tab=is_alert#examples">Monitor documentation.</a></div> | ||
|
|
||
| ### 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,37 @@ 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 | ||
|
|
||
| ```handlebars | ||
| ```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}} | ||
| ``` | ||
|
|
||
| <div class="alert alert-info">For a complete list of API test error codes, see <a href="/synthetics/api_tests/errors/">API Testing Errors</a>.</div> | ||
|
|
||
| ### 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"}} | ||
|
|
@@ -53,26 +77,28 @@ 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 | ||
|
|
||
| ```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}}`. | ||
| 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 @[email protected] | ||
|
|
||
| {{#is_alert}}send a message to <name> @[email protected] | ||
| {{#each synthetics.attributes.result.steps}} | ||
| {{#is_match "status" "failed"}} | ||
| {{#is_match "name" "stagedomain"}}Stage domain failed. Overriding priority to P2. | ||
|
|
@@ -84,11 +110,11 @@ 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}}`. | ||
| 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}} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.