Skip to content

fix: count broadcast deliveries as sent and leave out the sender - #1149

Open
tmbs88 wants to merge 1 commit into
deepstreamIO:masterfrom
tmbs88:fix/monitoring-broadcast-counts
Open

tmbs88 wants to merge 1 commit into
deepstreamIO:masterfrom
tmbs88:fix/monitoring-broadcast-counts

Conversation

@tmbs88

@tmbs88 tmbs88 commented Nov 14, 2026

Copy link
Copy Markdown

Fixes #1148

Monitoring stats miscount event broadcasts:

  • MonitoringBase.onBroadcast looked up receiveStats but stored new maps in sendStats, so deliveries were added to received (or replaced a topic's existing send counts). It now uses sendStats for both.
  • DefaultSubscriptionRegistry.sendToSubscribers reported subscribers.size, including the sender's socket that the loop below skips. It now reports only the sockets the message is sent to.

Tests:

  • src/services/monitoring/monitoring-base.spec.ts (new): broadcasts count as sent, add to existing send counts on the topic, and counters reset after reading.
  • default-subscription-registry.spec.ts: onBroadcast is called with the number of recipients, excluding the sender.

Without the fix the three new assertions fail; with it, npm test gives 402 passing / 49 pending (398 / 49 before) and npm run lint is clean, on Node 22.

onBroadcast looked up receiveStats but stored new maps in sendStats, so
deliveries were added to the received counts (or replaced a topic's
send counts). sendToSubscribers reported subscribers.size, including the
sender's socket that the loop skips.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monitoring miscounts event broadcasts: deliveries counted as received, sender counted as a recipient

1 participant