-
Notifications
You must be signed in to change notification settings - Fork 500
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
Added documentation for printing associated queries, and sample documents in notification message. #6866
Added documentation for printing associated queries, and sample documents in notification message. #6866
Conversation
…ents in notification message. Signed-off-by: AWSHurneyt <[email protected]>
b40c4bf
to
98767e6
Compare
Draft discussion forum post - https://forum.opensearch.org/t/alerting-sample-documents-for-ctx-dedupedalerts-and-ctx-completedalerts/18695 |
Thanks so much for adding this content, @AWSHurneyt! Is it ready for a doc review? |
@hdhalter Yes, this can be reviewed. I actually have a few other updates I was considering adding to this PR as well. We're still waiting for final approval though, so I'll just create a separate PR for them. Those updates would have be unrelated to the feature described in these doc changes; so it's probably for the best to keep them separate. |
|
||
```groovy | ||
Alerts | ||
{{#ctx.alerts}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question for documentation reviewers:
The following sentence on line 146, calls out that the variable names for the "alerts" list is newAlerts
for per bucket monitors, and alerts
for per document monitors.
Each new alert that's generated during a monitor execution will be added to a list (i.e.,
newAlerts
for per bucket monitors, andalerts
for per document monitors) within thectx
variable.
The example in this code block is for a per document monitor as, on line 188, the "alerts" list is accessed via {{#ctx.alerts}}
instead of {{#ctx.newAlerts}}
. Does that seem clear enough, or would it be helpful to update the note on line 184 to call out that the example is for a per document monitor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets update line 184 and call it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revised.
Signed-off-by: Naarcha-AWS <[email protected]>
|
||
```groovy | ||
Alerts | ||
{{#ctx.alerts}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets update line 184 and call it out.
Co-authored-by: Naarcha-AWS <[email protected]> Signed-off-by: AWSHurneyt <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AWSHurneyt @Naarcha-AWS Please see my comments and changes and let me know if you have any questions. Thanks!
`bucket_keys` | String | Comma-separated list of the monitor's bucket key values. Available only for `ctx.dedupedAlerts`, `ctx.newAlerts`, and `ctx.completedAlerts`. Accessed through `ctx.dedupedAlerts[0].bucket_keys`. | ||
`parent_bucket_path` | String | The parent bucket path of the bucket that triggered the alert. Accessed through `ctx.dedupedAlerts[0].parent_bucket_path`. | ||
`ctx.alerts` | Array | Newly created alerts. Includes the `ctx.alerts.0.finding_ids` that triggered the alert and the `ctx.alerts.0.related_doc_ids` associated with the findings. Only available with document-level monitors. | ||
`ctx.dedupedAlerts` | Array | Alerts that have been triggered. OpenSearch keeps the existing alert to prevent the plugin from creating endless numbers of the same alert. Only available with bucket-level monitors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Alerts that have been triggered" => "Triggered alerts"? "creating endless numbers of the same alert" => "perpetually creating the same alert"?
`bucket_keys` | String | A comma-separated list of the monitor's bucket key values. Available only for `ctx.dedupedAlerts`, `ctx.newAlerts`, and `ctx.completedAlerts`. Accessed through the `ctx.dedupedAlerts.0.bucket_keys` variable. | ||
`parent_bucket_path` | String | The parent bucket path of the bucket that triggered the alert. Accessed through `ctx.dedupedAlerts.0.parent_bucket_path`. | ||
`associated_queries` | Array | An array of document-level monitor queries that triggered the creation of the finding associated with the alert. Only available with document-level monitors. Accessed through the `ctx.alerts.0.associated_queries` variable. | ||
`sample_documents` | Array | An array of sample documents that matched the monitor query. Only available with bucket-level, and document-level monitors. Accessed through `ctx.newAlerts.0.sample_documents` and `ctx.alerts.0.sample_documents` variables, respectively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second sentence: "Available with both bucket- and document-level monitors"?
Co-authored-by: Nathan Bower <[email protected]> Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
…ents in notification message. (#6866) * Added documentation for printing associated queries, and sample documents in notification message. Signed-off-by: AWSHurneyt <[email protected]> * Apply suggestions from code review Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Co-authored-by: Naarcha-AWS <[email protected]> Signed-off-by: AWSHurneyt <[email protected]> * Revised draft. * Update _observing-your-data/alerting/triggers.md Signed-off-by: Naarcha-AWS <[email protected]> * Update _observing-your-data/alerting/triggers.md Signed-off-by: Naarcha-AWS <[email protected]> * Update _observing-your-data/alerting/triggers.md Signed-off-by: Naarcha-AWS <[email protected]> * Update _observing-your-data/alerting/triggers.md Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Co-authored-by: Nathan Bower <[email protected]> Signed-off-by: Naarcha-AWS <[email protected]> * Update _observing-your-data/alerting/triggers.md Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Signed-off-by: Naarcha-AWS <[email protected]> --------- Signed-off-by: AWSHurneyt <[email protected]> Signed-off-by: Naarcha-AWS <[email protected]> Co-authored-by: Naarcha-AWS <[email protected]> Co-authored-by: Nathan Bower <[email protected]> (cherry picked from commit a4fb638) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
ctx
arrays from using brackets (e.g.,itemList[0]
) as mustache template uses dot notation (e.g.,itemList.0
).associated_queries
, andsample_documents
variables added to thectx
object.Implementation PR for reference - opensearch-project/alerting#1450
Issues Resolved
opensearch-project/alerting#1300
opensearch-project/alerting#1396
opensearch-project/alerting#1401
Checklist
For more information on following Developer Certificate of Origin and signing off your commits, please check here.