Skip to content

feat: implement threaded message strategy for Slack notifier#5227

Draft
santiagofn wants to merge 4 commits into
prometheus:mainfrom
santiagofn:feat/slack-thread-implementation
Draft

feat: implement threaded message strategy for Slack notifier#5227
santiagofn wants to merge 4 commits into
prometheus:mainfrom
santiagofn:feat/slack-thread-implementation

Conversation

@santiagofn
Copy link
Copy Markdown
Contributor

@santiagofn santiagofn commented May 6, 2026

Part 5 of a series implementing threaded message support for the Slack notifier. Full picture: #5150. Depends on #5239, #5225, and #5226.

Summary

Implements the core threaded message strategy. When message_strategy: thread is configured, a parent summary message is posted first, and subsequent firing/resolved notifications are posted as thread replies. The strategy uses the notification log to persist the parent message's ts and channel across alert state changes, enabling correct threading even across alert manager restarts.

Also implements support for updating the parent message emoji and text on resolution when resolve_emoji or update_parent_on_resolve are configured.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f7be9e4c-5589-4223-95ec-a8d962fffe32

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@santiagofn santiagofn force-pushed the feat/slack-thread-implementation branch 6 times, most recently from 2125b4d to db7ad6c Compare May 19, 2026 17:39
santiagofn and others added 4 commits May 19, 2026 14:44
Moves SlackConfig (and the related SlackAction, SlackConfirmationField,
SlackField types plus DefaultSlackConfig) from config/notifiers.go into
a new notify/slack/config.go, following the same pattern used recently
for the mattermost, jira, and incidentio notifiers.

While moving them, the Slack prefix is dropped per the package-naming
guidance in https://go.dev/blog/package-names ("Avoid repetition"):
SlackConfig -> Config, DefaultSlackConfig -> DefaultConfig, SlackAction
-> Action, SlackConfirmationField -> ConfirmationField, SlackField ->
Field. External callers now refer to slack.Config etc., reading better
than the previous slack.SlackConfig stutter.

The Slack-specific unmarshal tests are moved alongside them into
notify/slack/config_test.go. config.Receiver now refers to
*slack.Config, and notify/slack no longer needs to import the top-level
config package.

No behavioral changes.

Signed-off-by: Santiago Fernández Núñez <santiago.nunez@nubank.com.br>
Co-authored-by: Cursor <cursoragent@cursor.com>
Previously the Slack notifier hardcoded the chat.update endpoint to
"https://slack.com/api/chat.update" regardless of the configured
api_url. Deployments pointing api_url at a Slack-compatible proxy or
forwarder were therefore forced back onto slack.com for update calls,
which is the wrong host for proxy users.

Move the URL handling into a new internal/apiurl package, and route
chat.update (and any future Slack Web API method) through the same
api_url / api_url_file base as the initial chat.postMessage call.
Standard configurations are unaffected; the generated URL is byte
identical.

The Resolver also reads api_url_file on every call, matching previous
behaviour so that file rotations apply to the next notification without
restarting Alertmanager.

Signed-off-by: Santiago Fernández Núñez <santiago.nunez@nubank.com.br>
Co-authored-by: Cursor <cursoragent@cursor.com>
…gies

Signed-off-by: Santiago Fernández Núñez <santiago.nunez@nubank.com.br>
Signed-off-by: Santiago Fernández Núñez <santiago.nunez@nubank.com.br>
Co-authored-by: Cursor <cursoragent@cursor.com>
@santiagofn santiagofn force-pushed the feat/slack-thread-implementation branch from db7ad6c to dbbd21d Compare May 19, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant