Skip to content

feat: event-loop lag monitor with sampling profile (closes #714) - #802

Closed
laurentketterle-hub wants to merge 2 commits into
RevoraOrg:masterfrom
laurentketterle-hub:feat/capacity-saturation-alerts-714
Closed

feat: event-loop lag monitor with sampling profile (closes #714)#802
laurentketterle-hub wants to merge 2 commits into
RevoraOrg:masterfrom
laurentketterle-hub:feat/capacity-saturation-alerts-714

Conversation

@laurentketterle-hub

Copy link
Copy Markdown
Contributor

Description

Implements event-loop lag monitor with sampling profile for capacity/saturation alerts.

Closes #714

Changes

  • New module: src/monitoring/event_loop_lag.py — Event-loop lag monitor with:
    • Configurable SamplingProfile (window size, sample interval, thresholds)
    • Real-time degradation detection with consecutive-sample tracking
    • Three alert levels: warning (100ms), critical (500ms), saturation (1000ms)
    • P50/P95/P99 percentile statistics
    • Thread-safe sampling with threading.Lock
    • Start/stop/reset lifecycle
    • Customizable alert callbacks (on_warning, on_critical, on_saturation)
  • Tests: tests/test_event_loop_lag.py — 13 tests covering:
    • Initial state, start/record/stop lifecycle
    • Lag detection and measurement accuracy
    • Stats aggregation (min, max, avg, percentiles)
    • Degraded/critical/saturation callbacks
    • Thread safety (via lock)
    • Reset behavior

How to verify

python -m pytest tests/test_event_loop_lag.py -v

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.

Capacity/saturation alerts: event-loop lag alarm with sampling profile capture

1 participant