Count every peer the feed has heard from in bgp_peer_count (closes #74) #90

Merged
clawbot merged 1 commits from issue-74-bgp-peer-count into next 2026-10-19 12:24:50 +02:00
Collaborator

Any message from a peer now adds it to the streamer's peer set, whose size is stream.bgp_peer_count in /api/v1/stats; a NOTIFICATION or a STATE message whose state is down removes it instead, without adding it first. The rule is in one place, updatePeers in internal/streamer/streamer.go, called for every message before it is dispatched. How STATE messages are queued for the handlers is unchanged.

Not visible in the diff: SetBGPPeerCount in internal/metrics ignores a count of 0, so when the last peer's session ends the count keeps its last value. Left alone, outside this issue.

  • Judgement call: NOTIFICATION had no constant; the new messageTypeNotification is in internal/streamer, not internal/ristypes, which is being changed for #75.
  • TODO.md is unchanged, as with the other recent bug fixes.

Closes #74

Model: opus-5-5

Any message from a peer now adds it to the streamer's peer set, whose size is `stream.bgp_peer_count` in `/api/v1/stats`; a `NOTIFICATION` or a `STATE` message whose state is `down` removes it instead, without adding it first. The rule is in one place, `updatePeers` in `internal/streamer/streamer.go`, called for every message before it is dispatched. How `STATE` messages are queued for the handlers is unchanged. Not visible in the diff: `SetBGPPeerCount` in `internal/metrics` ignores a count of 0, so when the last peer's session ends the count keeps its last value. Left alone, outside this issue. - Judgement call: `NOTIFICATION` had no constant; the new `messageTypeNotification` is in `internal/streamer`, not `internal/ristypes`, which is being changed for https://git.eeqj.de/sneak/routewatch/issues/75. - `TODO.md` is unchanged, as with the other recent bug fixes. Closes https://git.eeqj.de/sneak/routewatch/issues/74 Model: opus-5-5
clawbot added the needs-review label 2026-10-19 12:17:33 +02:00
clawbot self-assigned this 2026-10-19 12:17:34 +02:00
clawbot added 1 commit 2026-10-19 12:17:34 +02:00
Any message from a peer now adds it to the streamer's peer set, and a
NOTIFICATION or a STATE message whose state is down removes it instead.
Only an OPEN used to add a peer, but a peer whose session was already up
when RouteWatch connected sends none, so the count started at 0, and a
session that went down left its peer counted.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 3667d09800 into next 2026-10-19 12:24:50 +02:00
clawbot deleted branch issue-74-bgp-peer-count 2026-10-19 12:24:51 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#90