Repository navigation
fix(prometheus): keep alerts readable through a flapping link - #117
Merged
Merged
Conversation
On a link that drops most inbound packets, scrapes, probes and NATS routes fail and pass in turn. Each of InstanceDown, PrometheusIsolated, ProbeFailed and NatsRouteMissing then fired and resolved every minute or two, so one outage became dozens of messages. keep_firing_for holds them as one alert until the target has answered for five minutes. The NATS leader reported its peers' replicas by their NATS server names, which need not match the inventory names the other alerts and the notification template key on, and put the leader's host on an alert about a lagging peer. Each server now reports its own state from /healthz?details=true and the stream info: NatsJetStreamBehind and NatsStreamBehind replace NatsPeerBehind and NatsStreamReplicaBehind and name the host that is behind. A replica cut off from the cluster still counts itself current, so a stream copy without a known leader is reported as behind too.
Owner
Author
|
Test plan
|
The header carried one duration, the oldest firing alert's, so a message that a new alert triggered read as if that alert had been down for minutes, and nothing showed which line was new. Each line now says when its alert started and for how long, or when it ended; 🆕 marks an alert fired under a minute ago, the one a group notification within group_interval is about.
Times trailing the description in italics read as part of it. A time column at the start, with ▸ on the new alert and a short duration at the end, reads like a log.
Status and category read as one icon pair; the hosts follow.
…own emoji A message split firing and resolved alerts under headers of the first one's severity and category, so a group of mixed alerts showed one icon set for all and a new alert was hard to find. Lines now run oldest first, firing and resolved together, each with when it fired or resolved and its own severity, category and host emoji; the header carries the firing severities, their hosts and their count. Alertmanager hands a group's alerts ordered by labels and templates cannot sort, so the template picks the earliest unprinted one on each pass.
…restarting it Alertmanager keeps alerts in memory only. A restart dropped them; they came back from each Prometheus one by one, each partial set differed from the notification log, and the group was notified again with every alert's old start time. Copying the templates before the upstream role leaves its copy, and so its restart handler, with nothing to do, and a reload keeps the alerts.
The ✅ already says it; the word repeated it. The README now suggests one group per route, so every message carries the whole state.
…ager is installed The templates dir can exist before the upstream role has created the alertmanager user, as it does in the molecule scenario, and the copy then failed to chown. A dir the alertmanager user owns means the upstream role has run; on a first install there is nothing to keep from restarting.
…eload in place The Telegram message format and NatsRouteMissing are unreleased, so their entries under Changed and Added describe them as they are now rather than as fixes. Reloading on a template change fixes a restart that 0.5.0 shipped.
… show who sees them Two Prometheus servers watching one host sent the same labels, so their copies were one alert whose state the latest update decided: one seeing the host down and the other up flipped it between firing and resolved. With an observer label naming each server's host the copies stay apart; an item stands for all copies of a description and state and shows the observers' emoji after 👀, its description on a line of its own.
An info alert is an event, such as a failover leader change, not a state that fires and resolves.
Items run oldest first and every message carries the whole state, so the change that sent it is the last item.
FailoverLeaderChanged fired only for a node that had not led in the ten minutes before, to stay quiet when a leader drops out for a restart or a fence and comes back. That also hid a real move back, such as a switch shortly after a failover. A move now is a node leading that did not lead two minutes before while another node did; a leader that returns after any gap with no other leader stays quiet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a link that drops most inbound packets, scrapes, probes and NATS routes fail and pass in turn, and one outage turned into dozens of Telegram messages that were hard to read. This keeps such an outage to a few messages, each showing the whole state.
Flapping.
InstanceDown,PrometheusIsolated,ProbeFailedandNatsRouteMissingcarrykeep_firing_for: 5m: one alert holds until the target has answered for five minutes.NATS alerts name the host that is behind. The meta and stream leaders reported their peers by NATS server name, which need not match
instance_name, and an alert about a lagging peer carried the leader's host.nats-metrics.pynow has each server report itself from/healthz?details=trueand its stream info:nats_jetstream_currentandnats_stream_current{stream}, the latter 0 also for a copy that knows no leader, as a replica cut off from the cluster still counts itself current.NatsJetStreamBehindandNatsStreamBehindreplaceNatsPeerBehindandNatsStreamReplicaBehind;nats_jetstream_peer_current,nats_stream_replica_currentandnats_stream_leaderare gone. Thenatsrole is unreleased, so nothing outside it depends on them.Telegram message. The header carried one duration, the oldest firing alert's, so a message a new alert triggered read as if that alert had been down for minutes. The header now holds the firing severities, their hosts and their count,
infoalerts left out as events; items run oldest first, firing and resolved together, each with when it fired or resolved, its severity, host and category emoji, and its description below. Alertmanager orders a group's alerts by labels and templates cannot sort, so the template picks the earliest unprinted alert on each pass.Observers. Two Prometheus servers watching one host sent the same labels, so their copies were one alert whose state the latest update decided: one seeing the host down and the other up flipped it between firing and resolved. With an
observerlabel set throughprometheus_alert_relabel_configsthe copies stay apart, and an item shows 👀 and the emoji of each observer that sees it. The README suggestsgroup_by: [], so each message carries everything that fires.Alertmanager reload. Every template change restarted Alertmanager: the upstream role's copy notifies a restart, and so did this role after the instance emojis. A restart drops the alerts Alertmanager holds in memory; they came back from each Prometheus one by one and were notified again with old start times. The templates are now copied before the upstream role, which then finds them current, and a reload keeps the alerts.