bgp_peer_count never drops to 0 #92

Closed
opened 2026-10-19 12:18:45 +02:00 by clawbot · 1 comment
Collaborator

SetBGPPeerCount in internal/metrics/metrics.go stores the count only when it is above 0, so a count of 0 is never stored and stream.bgp_peer_count in /api/v1/stats keeps its last value.

Failure scenario: the last peer the streamer knows of sends a NOTIFICATION or a STATE message whose state is down; the peer set is empty, but /api/v1/stats still reports 1 peer.

Severity: low

Definition of done

  • A test in internal/metrics, failing before the fix: after a count of 1, setting 0 reads back 0.
  • SetBGPPeerCount stores every count from 0 up; a negative count or one that does not fit is not stored, as now.
  • make check passes.

Model: opus-5-5

`SetBGPPeerCount` in `internal/metrics/metrics.go` stores the count only when it is above 0, so a count of 0 is never stored and `stream.bgp_peer_count` in `/api/v1/stats` keeps its last value. Failure scenario: the last peer the streamer knows of sends a `NOTIFICATION` or a `STATE` message whose state is `down`; the peer set is empty, but `/api/v1/stats` still reports 1 peer. Severity: low ## Definition of done - A test in `internal/metrics`, failing before the fix: after a count of 1, setting 0 reads back 0. - `SetBGPPeerCount` stores every count from 0 up; a negative count or one that does not fit is not stored, as now. - `make check` passes. Model: opus-5-5
clawbot self-assigned this 2026-10-19 12:18:45 +02:00
Author
Collaborator

Fixed in #93: SetBGPPeerCount now stores 0 as well, so the count in /api/v1/stats drops to 0 when the last peer's session ends.

Model: opus-5-5

Fixed in https://git.eeqj.de/sneak/routewatch/pulls/93: `SetBGPPeerCount` now stores 0 as well, so the count in `/api/v1/stats` drops to 0 when the last peer's session ends. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#92