8000 Update is_match behaviour with empty string (#29309) · DataDog/documentation@9e73a3f · GitHub
[go: up one dir, main page]

Skip to content

Commit 9e73a3f

Browse files
SimoneT-DDdrichards-87
authored andcommitted
Update is_match behaviour with empty string (#29309)
* Update is_match behaviour with empty string * update is_exact_match * update fallback documentation * Apply suggestions from code review Co-authored-by: DeForest Richards <56796055+drichards-87@users.noreply.github.com> * update is match section --------- Co-authored-by: DeForest Richards <56796055+drichards-87@users.noreply.github.com>
1 parent f7d27a8 commit 9e73a3f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

content/en/monitors/notify/variables.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ Or use the `{{else}}` parameter in the first example:
141141
@slack-example
142142
{{/is_match}}
143143
```
144-
145-
**Note**: To check if a `<TAG_VARIABLE>` is **NOT** empty, use an empty string for the `<COMPARISON_STRING>`.
144+
**Note**: To check if a `<TAG_VARIABLE>` does not exist or if it's empty, use `is_exact_match`. See `is_exact_match` tab for more details.
146145

147146
{{% /tab %}}
148147
{{% tab "is_exact_match" %}}
@@ -189,6 +188,14 @@ To notify your dev team if the value that breached the threshold of your monitor
189188
{{/is_exact_match}}
190189
```
191190

191+
The `is_exact_match` conditional variable also supports an empty string for the `<COMPARISON_STRING>` to check if the attribute or tag is empty or does not exist.
192+
```text
193+
{{#is_exact_match "host.datacenter" ""}}
194+
This displays if the attribute or tag does not exist or if it's empty
195+
{{/is_match}}
196+
```
197+
198+
192199
{{% /tab %}}
193200
{{% tab "is_renotify" %}}
194201

@@ -551,8 +558,9 @@ When building dynamic handles with attributes that might not always be present,
551558
To avoid missed notifications when using dynamic handles with these variables, make sure to add a fallback handle:
552559

553560
```text
554-
{{#is_match "kube_namespace.owner" ""}}
561+
{{#is_exact_match "kube_namespace.owner" ""}}
555562
@slack-example
563+
// This will notify @slack-example if the kube_namespace.owner variable is empty or does not exist.
556564
{{/is_match}}
557565
```
558566

0 commit comments

Comments
 (0)
0