Rule Patterns and Examples¶
Observability provides patterns to help with the construction of meaningful rules based on a standard trigger-condition-action format. The following tables give some examples of the conditions and actions you can set up for each type of rule trigger.
Tip
For technical details about each type of rule, see Observability Rule Triggers.
Examples by trigger¶
Task status¶
Task status rules can be set for * batch pipeline tasks with a failed, completed, running, or completed with warnings status.
| Rule trigger and condition | Rule action |
|---|---|
When task statusis CompletedFor any component in journey * |
Send email to email address 1, email address 2 |
When task statusis FailedFor <a specific batch pipeline> |
Send web request to URLThen, specify the payload, and optionally, the headers. |
Runs¶
Run rules can be set for * batch pipeline run statuses, timeliness, and unexpected changes.
| Rule trigger and condition | Rule action |
|---|---|
When runhas a running statusFor <a specific batch pipeline> |
Send email to email address 1, email address 2 |
When runhas a completed with warnings statusFor any component in journey * |
Send web request to URLThen, specify the payload, and optionally, the headers. |
When runhas a missing statusFor <a specific batch pipeline> |
Send email to email address 1, email address 2 |
When runhas a late start time, late end timeFor any component in journey * |
Send web request to URLThen, specify the payload, and optionally, the headers. |
Advanced run rule options¶
You can configure advanced conditions for all cases except running status.
| Rule trigger and condition | Rule action | Summary of the outcome |
|---|---|---|
When runhas a failed statusFor <a specific batch pipeline>Advanced Options after 10 occurrences of this status in a rowand grouped by run name Trigger action for each subsequent occurrence of this status |
Send web request to URLThen, specify the payload, and optionally, the headers. |
The system sends a web request to the URL when Observability receives 10 runs in a row for the specified pipeline, where all runs have a Failed status and the same name. The system only sends one notification when the condition is met (and not, for example, if these conditions are met an eleventh or twelfth time). Note that the system can receive other events or other runs with different run names during this time. |
When runhas a completed statusFor any component in journey *Advanced Options after 2 occurrences of this status in a rowand grouped by run name Trigger action for each subsequent occurrence of this status |
Send email to email address 1, email address 2 |
When Observability receives 2 runs in a row with status Completed, for each batch pipeline in this journey, the system sends an email to the two recipients with details. The system sends one email when the condition is met, and with each following Completed status received. |
Test status¶
Test status rules can be set for tests with a failed, warning, or passed status.
| Rule trigger and condition | Rule action |
|---|---|
When test statusis PassedFor any component in journey |
Send email to email address 1, email address 2 |
When test statusis FailedFor <a specific batch pipeline> |
Send web request to URLThen, specify the payload, and optionally, the headers. |
When test statusis WarningFor <a specific dataset> |
Send web request to URLThen, specify the payload, and optionally, the headers. |
Message log¶
Message log rules can be set for severity log levels of error, warning, and/or info. You can include regex patterns to check against the log message.
| Rule trigger and condition | Rule action |
|---|---|
When log matcheslevel = Errorand message contains (?:|\)limit(?:|\)For any component in journey |
Send email to email address 1, email address 2 |
When log matcheslevel = anyand message contains ^This exact message only$For <a specific batch pipeline> |
Send web request to URLThen, specify the payload, and optionally, the headers. |
When log matcheslevel = Error, Infoand message contains input_data[\d]+.csvFor <a specific dataset> |
Send email to email address 1, email address 2 |
When log matcheslevel = anyand message contains ________For <a specific server> |
Send web request to URLThen, specify the payload, and optionally, the headers. |
Metric log¶
Metric log rules can be set for data values equal to, less than, less than or equal, greater than, or greater than or equal to a specific numeric value.
| Rule trigger and condition | Rule action |
|---|---|
When metric matcheskey = key_example_1and value equals 1For any component in journey |
Send email to email address 1, email address 2 |
When metric matcheskey = key_example_2and value less than or equal 100For <a specific streaming pipeline> |
Send web request to URLThen, specify the payload, and optionally, the headers. |
When metric matcheskey = ______and value greater than or equals 10For any component in journey |
Send email to email address 1, email address 2 |
When metric matcheskey = ______and value ________For <a specific dataset> |
Send web request to URLThen, specify the payload, and optionally, the headers. |
Instance alert¶
Instance alert rules can be set for instances that have error-level and/or warning-level alerts.
| Rule trigger and condition | Rule action |
|---|---|
When instance has alertof type Incomplete |
Send web request to URLThen, specify the payload, and optionally, the headers. |
When instance has alertof type Out of sequence, Dataset not ready |
Send email to email address 1, email address 2 |