prometheus / prometheus/alertmanager

Using repetitive blocks for slack_config in alertmanager config file

Open
#3,248 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component/config stale
Dominant language
Go
Stars
8.6k
Forks
2.5k
Avg merge
2d 6h
Merged PRs (30d)
61

Description

How we can omit having repetitive blocks for similar slack_configs. Is there a chance defining just -channel and define all other fields in only one place within alertmanager config file...?

These are my receivers:

receivers:
  - name: 'slack-admin'
    slack_configs:
    - channel: '#slack-admin'
      send_resolved: true
      icon_url: https://avatars3.githubusercontent.com/u/3380462
      title: '{{ template "slack.slack_alert.title" .}}'
      text: '{{ template "slack.slack_alert.text" .}}'

  - name: 'slack-ch1'
    slack_configs:
    - channel: '#slack-ch1'
      send_resolved: true
      icon_url: https://avatars3.githubusercontent.com/u/3380462  
      title: '{{ template "slack.slack_alert.title" .}}'
      text: '{{ template "slack.slack_alert.text" .}}'

I'd like if I can define them something like this:

  - name: 'slack-admin'
    slack_configs: '{{ template slack.slack_config admin }}'
  - name: 'slack-ch1'
    slack_configs: '{{ template slack.slack_config ch1 }}'

and define other fields in template files like we do for title & text for example.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no implementation files or tests. Start by locating receiver slack_configs parsing and the existing title/text template handling; determine how reusable Slack configuration templates would fit there. Done means similar receivers can share the non-channel fields while retaining distinct channels, with coverage for the requested configuration form.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, yaml
Domain
observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.