Alerting: sample_documents for ctx.dedupedAlerts and ctx.completedAlerts

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

Describe the issue:
Added documentation for printing associated queries, and sample documents in notification message. by AWSHurneyt · Pull Request #6866 · opensearch-project/documentation-website · GitHub


Do sample_documents also exist for ctx.dedupedAlerts and ctx.completedAlerts or only for ctx.newAlerts

like: ctx.newAlerts.0.sample_documents

Right now, we’re only adding support for printing sample_documents for newAlerts. We’re able to gather those documents during the execution of the monitor. To make sample docs available for deduped, and completed alerts would require a bit more work as we’ll need to decide how best to acquire that snapshot of documents. For example, I have a follow-up item for this feature to explore whether we could effectively achieve this by storing the IDs for the sample docs in the alert data model.

do you know of another way to get sample_documents other then ctx.newAlerts.0.sample_documents?

For per bucket monitors, sample_documents are only collected and available under the newAlerts variable. For per document monitors, sample_documents are available under the alerts variable (e.g., ctx.alerts.0.sample_documents).

ok thanks!

but sample_documents for ctx.dedupedAlerts and ctx.completedAlerts would really be great.
so thumbs up for your follow-up item for this feature!!