From 953263f91b187abe3638264d0df02eb000bd7cca Mon Sep 17 00:00:00 2001 From: Pepe Cano <825430+ppcano@users.noreply.github.com> Date: Wed, 19 Feb 2025 11:00:07 +0100 Subject: [PATCH] Alerting notification preview: Remove private annotations and labels from alert instance payload (#100410) --- .../components/receivers/AlertInstanceModalSelector.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/app/features/alerting/unified/components/receivers/AlertInstanceModalSelector.tsx b/public/app/features/alerting/unified/components/receivers/AlertInstanceModalSelector.tsx index 05ace6725db..cd3e7c5d284 100644 --- a/public/app/features/alerting/unified/components/receivers/AlertInstanceModalSelector.tsx +++ b/public/app/features/alerting/unified/components/receivers/AlertInstanceModalSelector.tsx @@ -60,6 +60,13 @@ export function AlertInstanceModalSelector({ if (!rules[instance.labels.alertname]) { rules[instance.labels.alertname] = []; } + const filteredAnnotations = Object.fromEntries( + Object.entries(instance.annotations).filter(([key]) => !key.startsWith('__')) + ); + const filteredLabels = Object.fromEntries( + Object.entries(instance.labels).filter(([key]) => !key.startsWith('__')) + ); + instance = { ...instance, annotations: filteredAnnotations, labels: filteredLabels }; rules[instance.labels.alertname].push(instance); }); }