Conversation
codingjoe
commented
Jul 8, 2026
There was a problem hiding this comment.
Pull request overview
This PR switches the inspector’s ingress/egress telemetry from Redis polling/time-series reads to a pub/sub-driven approach, adding live sparklines backed by an in-memory rolling buffer while keeping queue segment counts sourced from backend snapshots.
Changes:
- Introduces an in-memory
TelemetryBufferand adds inspector sparklines that refresh on a timer from pub/sub events. - Replaces the backend telemetry polling API with
queue_stats()(async counts snapshot) plusworker_telemetry()(async pub/sub stream). - Updates the Redis backend to publish ingress/egress events via Redis pub/sub and adjusts tests accordingly.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| threadmill/inspector/telemetry.py | Adds a rolling per-second buffer to aggregate pub/sub telemetry into series/rates. |
| threadmill/inspector/inspector.scss | Styles new ingress/egress sparkline widgets and adjusts layout sizing. |
| threadmill/inspector/app.py | Wires up pub/sub listener + rolling buffer, adds sparklines, and migrates inspector refresh to async queue_stats(). |
| threadmill/backends/redis.py | Publishes telemetry via pub/sub; adds queue_stats() + worker_telemetry() implementations. |
| threadmill/backends/lua/acknowledge.lua | Publishes egress telemetry on acknowledge via Redis PUBLISH. |
| threadmill/backends/base.py | Introduces TelemetryDirection/TelemetryEvent and replaces telemetry API with async queue_stats() + worker_telemetry(). |
| tests/test_inspector.py | Updates inspector tests to use queue_stats() and adjusts timer expectations. |
| tests/backends/test_redis.py | Replaces telemetry polling tests with pub/sub publish assertions and async queue_stats() usage. |
| tests/backends/test_base.py | Updates base-backend contract tests for async queue_stats(). |
| AGENTS.md | Adds docstring style guidance for mkdocs (Google style; avoid RST directives). |
Comments suppressed due to low confidence (1)
threadmill/inspector/app.py:626
- If the backend telemetry stream raises an exception (network issue, decode error, etc.), the listener task will currently stop silently. Logging unexpected exceptions here would make failures visible and help avoid a “stuck at zero” UI with no clue why.
try:
async for event in stream:
self.telemetry_buffer.record(event, now=time.monotonic())
except asyncio.CancelledError:
raise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.