Skip to content

fix: parse site24x7 LABELS as dict for AlertDto compatibility#6526

Merged
shahargl merged 1 commit into
keephq:mainfrom
Jleee713:fix/site24x7-labels-dicts
May 25, 2026
Merged

fix: parse site24x7 LABELS as dict for AlertDto compatibility#6526
shahargl merged 1 commit into
keephq:mainfrom
Jleee713:fix/site24x7-labels-dicts

Conversation

@Jleee713
Copy link
Copy Markdown
Contributor

@Jleee713 Jleee713 commented May 25, 2026

Closes #6527

📑 Description

Fix Site24X7Provider._format_alert incorrectly parsing the LABELS webhook field as a list instead of a dict.

AlertDto.labels is typed as dict | None, so passing a list caused labels to be silently dropped by pydantic on alert ingestion.

  • Parse LABELS string (e.g. "env:prod,team:sre") into a dict ({"env": "prod", "team": "sre"})
  • Handle pre-parsed dict payloads passthrough
  • Fall back to {} for empty/missing values

✅ 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 was split into a list of strings and passed to AlertDto.labels, which expects a dict — causing labels to never appear on alerts.

After: LABELS is parsed as key:value pairs into a dict. Keys without a : separator are stored with an empty string value.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 25, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 25, 2026

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot Bot added the Bug Something isn't working label May 25, 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.

lgtm

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 25, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 30.54%. Comparing base (5fc042d) to head (cf72fde).
⚠️ Report is 45 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6526       +/-   ##
===========================================
- Coverage   46.41%   30.54%   -15.88%     
===========================================
  Files         176      101       -75     
  Lines       18443    11694     -6749     
===========================================
- Hits         8561     3572     -4989     
+ Misses       9882     8122     -1760     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shahargl shahargl merged commit bb33c18 into keephq:main May 25, 2026
16 of 21 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

ghost commented May 25, 2026

💪 Fantastic work @Jleee713! Your very first PR to keep has been merged! 🎉🥳

You've just taken your first step into open-source, and we couldn't be happier to have you onboard. 🙌
If you're feeling adventurous, why not dive into another issue and keep contributing? The community would love to see more from you! 🚀

For any support, feel free to reach out on the community: https://slack.keephq.dev. Happy coding! 👩‍💻👨‍💻

@Jleee713 Jleee713 deleted the fix/site24x7-labels-dicts branch May 25, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working lgtm This PR has been approved by a maintainer 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 LABELS still not passed correctly to AlertDto after #6196

3 participants