Repository navigation
otel: ObserveLeader, gauges of a node's grpcproc/leader elections - #70
Merged
Merged
Conversation
ObserveLeader reads each elector on the node at each collection, from the map it publishes through WithInspect, and reports one set of gauges per election by grpcproc.leader.cluster: electors (1, by grpcproc.leader.role), stalled, term, view, quorum, reachable (the view it hears from, itself included), singleton (1 while it runs here) and checkpoints.waiting. - Electors are the processes named leader.ElectorName(cluster) with the elector's label; one that publishes no role, or is exiting, is skipped. - They are asked at once, within one second of the collection. One that the snapshot shows on one message for a second (BusyFor), or that does not answer within the second, is reported as stalled with no other gauge: what it answered before may no longer be what it believes. A collection that ends sooner reports nothing of it. - It builds on leader v0.13.0 as published: the inspect keys, the label and the PID's form are leader's, not its API, and TestObserveLeader, against a real election, is what notices a change to them. - Observe and ObserveLeader share one gauge helper. The otel README and the observability guide list the gauges and PromQL alerts per cluster (no leader, two leaders, the singleton nowhere or twice, one node from losing a majority, term churn, waiting checkpoints, a stalled elector) and what to set their for: to. The operations guide's "no metric carries the term" now points at grpcproc.leader.term, and the leader README and guide at ObserveLeader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
grpcprocotel.Hooks.ObserveLeader(node)registers gauges read at each collection from the node's grpcproc/leader electors, one set per election, bygrpcproc.leader.cluster:grpcproc.leader.electorsgrpcproc.leader.role: leader, candidate, follower or unclusteredgrpcproc.leader.stalledgrpcproc.leader.term,.view,.quorumgrpcproc.leader.reachablegrpcproc.leader.singletongrpcproc.leader.checkpoints.waitingCheckpointcalls waiting for a majorityThe otel README and the observability guide list PromQL alerts per cluster:
They also say how long a
for:each needs.How
WithInspect, the same waytools/clientreads elections.TestObserveLeaderruns a real election against the core otel requires, so a change to any of them fails it when otel moves to the next core.BusyFor), or that doesn't answer within the second, is reported as stalled with no other gauge. A collection that ends sooner reports nothing about it.Testing
go test -race, and 100% coverage.-race.ctxcheck: I removed the check on why the wait ended, andTestObserveLeaderStalledfailed as it should.gofmt -l.npm run check, plus a build.Known gaps
for:longer than anElectionTimeoutabove that.🤖 Generated with Claude Code