Repository navigation
Conversation
Routing rules can set notify_email_label to a label key. When that label holds an email, Regen looks the address up in Slack and sends a DM. The DM is sent even if the rule suppresses the incident. Closes FluidifyAI#174
|
Thanks for the PR, Youssef. My main question is about scope. Regen is built around incidents and on-call, and this adds a path that DMs someone from an alert with no incident and no schedule involved. For the CI case, a GitHub/GitLab Slack integration or a small script on your side already does this. What does having it in the routing rules give you that those don't? If we do keep it, a few things to sort out:
Happy to talk it through if you think I'm missing the use case. |
|
Fair question. The case I had was any alert that carries an owner email label, not only CI. The alert is already in Regen with Slack set up, so the rule sits next to the other actions instead of in a separate script. If that is not where you want Regen to go, I am happy to close this. If you want to keep it, I would restrict the DM to addresses that match an existing Regen user, confirm the lookup goes through users.lookupByEmail only, run make test and a real DM, and update the checklist. |
|
That makes sense, owner routing is a better framing than CI. Let's keep it with your changes: restrict DMs to emails matching an existing Regen user, |
The label address must match an active Regen user. When that user has a linked Slack ID the DM goes straight to it. Otherwise the address is resolved with users.lookupByEmail only; the display-name fallback in SendDirectMessage is not used for this path. Signed-off-by: Youssef Omar Bouden <youssef.bouden2002@gmail.com>
|
Thanks, the new commit does what we discussed. Before merge:
We can look at rate limiting separately. |
…-insensitively A stored Slack ID is sent to the DM method that skips every lookup, so IDs that do not start with U (Enterprise Grid W IDs) no longer fall into the display-name scan. The label email is lower-cased before the user lookup and GetByEmail compares with LOWER() on both sides. The routing doc notes that the webhook sender controls the DM text. Signed-off-by: Youssef Omar Bouden <youssef.bouden2002@gmail.com>
Summary
A routing rule can name a label that holds an email. When the address belongs to an active Regen user, Regen sends that user a Slack DM. The DM still goes out when the rule suppresses the incident, so an alert can reach its owner without opening an incident or paging the on-call schedule.
Only Regen users can be reached. Addresses that do not match a user are ignored, so a webhook sender cannot DM arbitrary workspace members. Email matching is case-insensitive. When the user has a linked Slack ID the DM goes straight to that ID with no lookup; otherwise the address is resolved with
users.lookupByEmailonly, with no display-name fallback.Type of change
Testing
make testpasses.down.sqlRan
make test(backend with-race, frontend vitest) andgolangci-lint runwith 0 issues. Sent one real DM from a suppressed alert carrying anownerlabel to a Regen user with no linked Slack ID, so theusers.lookupByEmailpath was exercised.Screenshots (if UI change)
Routing rule form has a "Slack DM from label" field.
Related issues
Closes #174