Skip to content

fix: Simpler approach to load all incident params into labels#6541

Open
Jleee713 wants to merge 2 commits into
keephq:mainfrom
Jleee713:fix/site24x7-incident-params-in-labels
Open

fix: Simpler approach to load all incident params into labels#6541
Jleee713 wants to merge 2 commits into
keephq:mainfrom
Jleee713:fix/site24x7-incident-params-in-labels

Conversation

@Jleee713
Copy link
Copy Markdown
Contributor

@Jleee713 Jleee713 commented May 28, 2026

📑 Description

closes #6542

Fix _format_alert in the Site24x7 provider so that webhook incident parameters are correctly surfaced as alert labels.

Previously the code looked for a LABELS key in the webhook payload (event.get("LABELS", "")), which Site24x7 never sends. Incident parameters ($STATUS, $MONITORTYPE, $INCIDENT_DETAILS, $FAILED_LOCATIONS, etc.) are delivered as top-level fields in the JSON body, so labels was always empty.

Change: replace the dead LABELS key lookup with a dict comprehension over all top-level event fields, so every incident parameter sent by Site24x7 is captured in labels.

Labels now populated from Site24x7 incident parameters on monitor DOWN/TROUBLE/CRITICAL/UP events
No manual field exclusion list — simpler and maintenance-free
Existing AlertDto fields (name, url, description, etc.) unchanged
✅ Checks
My pull request adheres to the code style of this project
My code requires changes to the documentation
I have updated the documentation as required
All the tests have passed
ℹ Additional Information
Before (labels always empty):

labels_raw = event.get("LABELS", "") # Site24x7 never sends this key
...
labels = {}
After (labels populated from all incident parameters):

labels = {k: str(v) for k, v in event.items() if v is not None}

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. Provider Providers related issues labels May 28, 2026
@Jleee713 Jleee713 changed the title Simpler approach to load all incident params into labels fix: Simpler approach to load all incident params into labels May 28, 2026
Copy link
Copy Markdown
Member

@shahargl shahargl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For backward compatibility, keep the original logic and just add the latter (instead of removing), unless you have a very good reason why the old logic is not needed

@Jleee713
Copy link
Copy Markdown
Contributor Author

The original logic only works if user configures custom labels parameters in Site24x7 for each monitor. The only use-case for that is if user does not want all incident parameters in webhook, however we can just pass all incident parameters with option to filter on keephq side.

Either way, this automatically populates the incident parameters in labels without repeated configuration from site24x7.

@shahargl
Copy link
Copy Markdown
Member

@Jleee713 but isn't Site24x7 is doing that with setup_webhook, so whoever installs it via setup webhook won't have labels now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Provider Providers related issues size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Site24x7 incident parameters not automatically loading in labels

2 participants