Skip to content

fix: generate UUID for prometheus alerts when id is not a valid uuid#6219

Open
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
DragonBot00:fix/prometheus-alert-id-uuid
Open

fix: generate UUID for prometheus alerts when id is not a valid uuid#6219
DragonBot00 wants to merge 1 commit intokeephq:mainfrom
DragonBot00:fix/prometheus-alert-id-uuid

Conversation

@DragonBot00
Copy link
Copy Markdown
Contributor

Fixes #4985

When Prometheus sends alerts via Alertmanager webhook, the id field contains the alertname string (e.g., HostOomKillDetected) rather than a UUID. This causes 500 errors when clicking alerts in workflow 'Triggered by' links, which expect a valid alert ID.

Changes

  • Added UUID generation for alert IDs that are not valid UUIDs
  • Preserves existing UUID-format IDs from the payload
  • Falls back to generating a new UUID when neither id nor �lertname is UUID-formatted

How it works

  • If id is present and is a valid UUID → use it as-is
  • If id is present but not a valid UUID (e.g., alertname string) → generate a new UUID
  • If id is missing → try labels.alertname, or generate a UUID as last resort

Testing

  • Existing prometheus provider tests pass
  • Alert with UUID-format id preserves the original id
  • Alert with string alertname (e.g., HostOomKillDetected) generates a new UUID

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 6, 2026
@dosubot dosubot bot added Bug Something isn't working Provider Providers related issues labels Apr 6, 2026
@DragonBot00
Copy link
Copy Markdown
Contributor Author

Hi maintainers, this PR has been open for a day with no review. The fix is a one-line change that resolves #4985 — Prometheus alerts store the alertname string as id instead of a UUID, breaking workflow links.

Would appreciate a quick review when you get a chance. Happy to adjust based on feedback.

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

Labels

Bug Something isn't working 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]: Prometheus provider stores alert name as alert id

1 participant