influxdata / influxdata/kapacitor
Kapacitor Should use slack's pretext field for uniformity
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
I am working with kapacitor alert module now. But I have met some issue.
In kapacitor/services/slack/service.go,
```
// slack attachment info
type attachment struct {
Fallback string `json:"fallback"`
Color string `json:"color"`
Text string `json:"text"`
Mrkdwn_in []string `json:"mrkdwn_in"`
}
```
The project only use text field, but from slack's api, we can see
```
{
"attachments": [
{
"title": "Title",
"pretext": "Pretext _supports_ mrkdwn",
"text": "Testing *right now!*",
"mrkdwn_in": ["text", "pretext"]
}
]
}
```
There is a pretext field. I think this is useful for alert.
Alongside, the mapping between email and slack is different. I have to use two different alert node to deal with it.(For slack, nil -> pretext, message -> text; For email, message-> title, details -> body).
For example, my tick is like below.
```
data
|alert()
.crit(condition)
.message(title + message)
.slack()
data
|alert()
.crit(condition)
.message(title)
.details(message)
.email()
```
This is just made me so confused.
Contributor guide
Research direction
Start in kapacitor/services/slack/service.go and inspect the attachment struct and how alert fields are mapped into Slack payloads. Compare that mapping with the email behavior described in the issue. Done means Slack alerts can use the pretext field for the intended title/message separation without requiring a separate alert node.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100