Skip to content

fix: handled non-matched ems events#4283

Merged
cgrinds merged 1 commit into
mainfrom
hl_ems
May 14, 2026
Merged

fix: handled non-matched ems events#4283
cgrinds merged 1 commit into
mainfrom
hl_ems

Conversation

@Hardikl
Copy link
Copy Markdown
Contributor

@Hardikl Hardikl commented May 13, 2026

Testing,
Case 1: when below order ems generated in sub sequent polls, then first ems retained in global e.Matrix cache and second is not valid so it won't add any new instance to existing matrix. No changes in this workflow.

{
    "message-name": "hm.alert.raised",
    "values": [1,2,"RaidLeftBehindAggrAlert",4,5,6,7,8,9,10,11,12,13,14]
}
{
    "message-name": "hm.alert.raised",
    "values": [1,2,3,4,5,6,7,8,9,10,11,12,13,14]
}

Case 2: when below order ems generated in sub sequent polls, then first ems is not valid and not matched and deleted from e.Matrix and second is valid so added in global e.Matrix cache as-is. Fix is targeting this workflow.

{
    "message-name": "hm.alert.raised",
    "values": [1,2,3,4,5,6,7,8,9,10,11,12,13,14]
}
{
    "message-name": "hm.alert.raised",
    "values": [1,2,"RaidLeftBehindAggrAlert",4,5,6,7,8,9,10,11,12,13,14]
}

Copilot AI review requested due to automatic review settings May 13, 2026 09:52
@cla-bot cla-bot Bot added the cla-signed label May 13, 2026
@Hardikl Hardikl linked an issue May 13, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes EMS matrix-cache behavior when an EMS record is received for a message name but does not match any configured matches filters, ensuring the collector doesn’t retain an empty/invalid matrix entry that can interfere with later valid events.

Changes:

  • Track whether an EMS matrix already existed vs. was newly created during HandleResults.
  • When an EMS record does not match any configured props, remove the instance and additionally delete the matrix entry if it was newly created for that non-matching record.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/collectors/ems/ems.go
Comment on lines 674 to +678
if !isMatch {
mx.RemoveInstance(instanceKey)
if !existingEms {
delete(m, msgName)
}
@cgrinds cgrinds merged commit 663dfba into main May 14, 2026
17 checks passed
@cgrinds cgrinds deleted the hl_ems branch May 14, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hm.alert.raised ems error out when alert_id is not matching

4 participants