-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alerting: Align notifier truncation and logging with prometheus/alertmanager #59339
Conversation
// TruncateInBytes truncates a string to fit the given size in Bytes. | ||
// TODO: This is more advanced than the upstream's TruncateInBytes. We should consider upstreaming this, and removing it from here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied verbatim from webex.go
. I added the TODO so we remember to do this in the future.
Prometheus's equivalent of this is also in util.go
so I felt this was the place of best alignment.
message = strings.TrimSpace(message) | ||
if message == "" { | ||
// Pushover rejects empty messages. | ||
message = "(no details)" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taken from Prometheus
lint error resolved in #59432 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Upstream PR is now merged, this is unblocked. Few minor changes to uptake. |
6f2509d
to
281f1ec
Compare
Some external systems have limits on message sizes. Prometheus handles this in a unified way. We recently touched this area in upstream.
The way we do truncation and log is very inconsistent in Grafana notifiers, even among each other.
Why do we need this feature?
This PR aligns Grafana's notifier field truncation with upstream. We now use the same logic in the same places, same constants, and emit the same logs.
Effectively, ports prometheus/alertmanager#3135 and prometheus/alertmanager#3145 to Grafana, plus some additional alignment that was missing entirely.
Who is this feature for?
Contributes to alignment of alertmanagers.
Which issue(s) does this PR fix?:
Contributes to https://github.com/grafana/alerting-squad/issues/304
Contributes to https://github.com/grafana/alerting-squad/issues/240
Special notes for your reviewer: