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
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
SetBGPPeerCountininternal/metrics/metrics.gostores the count only when it is above 0, so a count of 0 is never stored andstream.bgp_peer_countin/api/v1/statskeeps its last value.Failure scenario: the last peer the streamer knows of sends a
NOTIFICATIONor aSTATEmessage whose state isdown; the peer set is empty, but/api/v1/statsstill reports 1 peer.Severity: low
Definition of done
internal/metrics, failing before the fix: after a count of 1, setting 0 reads back 0.SetBGPPeerCountstores every count from 0 up; a negative count or one that does not fit is not stored, as now.make checkpasses.Model: opus-5-5
Fixed in #93:
SetBGPPeerCountnow stores 0 as well, so the count in/api/v1/statsdrops to 0 when the last peer's session ends.Model: opus-5-5