Skip to content

feat(event_bus): Add dropped event counter and overflow warning for observability#5951

Closed
namo507 wants to merge 1 commit intoaden-hive:mainfrom
namo507:patch-1
Closed

feat(event_bus): Add dropped event counter and overflow warning for observability#5951
namo507 wants to merge 1 commit intoaden-hive:mainfrom
namo507:patch-1

Conversation

@namo507
Copy link

@namo507 namo507 commented Mar 6, 2026

Summary

Adds observability hooks to EventBus so you can actually tell when events are being dropped from the history buffer. Addresses #5944.

Changes:

  • Added import time (needed for the overflow warning throttle in the follow-up)
  • Added get_stats() method returning:
    • total_events: current history buffer size
    • dropped_events: count of events trimmed from history (uses getattr for backward compat)
    • subscriptions: number of active subscriptions
    • events_by_type: breakdown of events in current history by type

Related issue: Closes #5944

Test plan

  • Publish 1500 events, verify get_stats()["dropped_events"] == 500
  • Verify get_stats() includes all expected keys
  • Verify warning is logged only once per 60s window (follow-up)
  • High-frequency publish doesn't degrade performance

Notes

The _dropped_events counter increment in publish() is coming in a follow-up commit. This PR sets up the get_stats() interface and time import as a foundation. Full overflow warning logic will be added next.

…metrics

Add a method to retrieve EventBus statistics.- Added `import time` for future overflow warning throttling
- Added `get_stats()` method that exposes total_events, dropped_events, subscriptions, and events_by_type
- Resolves: aden-hive#5944

This is part of the feat/event-bus-overflow-metrics PR proposal.
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

PR Closed - Requirements Not Met

This PR has been automatically closed because it doesn't meet the requirements.

PR Author: @namo507
Found issues: #5944 (assignees: none)
Problem: The PR author must be assigned to the linked issue.

To fix:

  1. Assign yourself (@namo507) to one of the linked issues
  2. Re-open this PR

Exception: To bypass this requirement, you can:

  • Add the micro-fix label or include micro-fix in your PR title for trivial fixes
  • Add the documentation label or include doc/docs in your PR title for documentation changes

Micro-fix requirements (must meet ALL):

Qualifies Disqualifies
< 20 lines changed Any functional bug fix
Typos & Documentation & Linting Refactoring for "clean code"
No logic/API/DB changes New features (even tiny ones)

Why is this required? See #472 for details.

@github-actions github-actions bot closed this Mar 6, 2026
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.

EventBus silently drops oldest events when history exceeds 1000 — consider overflow callback or metrics

1 participant