feat: Add diagnostics library for tracking stats/counters#673
Merged
allenporter merged 8 commits intoPython-roborock:mainfrom Dec 17, 2025
Merged
feat: Add diagnostics library for tracking stats/counters#673allenporter merged 8 commits intoPython-roborock:mainfrom
allenporter merged 8 commits intoPython-roborock:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a generic diagnostics library to track operational statistics and timing metrics across the codebase, with initial implementation focused on MQTT session metrics.
- Introduces a
Diagnosticsclass supporting counter increments, timing measurements, and hierarchical subkey organization - Integrates diagnostics tracking into MQTT sessions (connection attempts, subscriptions, message dispatches) and device manager operations
- Provides comprehensive test coverage for the diagnostics module and its integration points
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
roborock/diagnostics.py |
New diagnostics module with counter, timer, and subkey support |
roborock/mqtt/session.py |
Adds diagnostics field to MqttParams dataclass |
roborock/mqtt/roborock_session.py |
Instruments MQTT operations with diagnostics tracking (connection, subscribe, publish, restart) |
roborock/devices/device_manager.py |
Integrates diagnostics into DeviceManager with device discovery tracking and data exposure |
tests/test_diagnostics.py |
Comprehensive unit tests for diagnostics functionality |
tests/mqtt/test_roborock_session.py |
Integration test validating MQTT diagnostics collection |
tests/devices/test_device_manager.py |
Integration test for device manager diagnostics |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Lash-L
previously approved these changes
Dec 16, 2025
Add a generic library that can be used to track counters, or elapsed time (e.g. how long it takes on average to connect to mqtt). This is a copy of https://github.com/allenporter/python-google-nest-sdm/blob/main/google_nest_sdm/diagnostics.py This is an initial pass to add a few initial example metrics for MQTT, but we can add more as we need fine grained details in diagnostics.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add a generic library that can be used to track counters, or elapsed time (e.g. how long it takes on average to connect to mqtt). This is a copy of https://github.com/allenporter/python-google-nest-sdm/blob/main/google_nest_sdm/diagnostics.py This is an initial pass to add a few initial example metrics for MQTT, but we can add more as we need fine grained details in diagnostics.
Add a generic library that can be used to track counters, or elapsed time (e.g. how long it takes on average to connect to mqtt). This is a copy of https://github.com/allenporter/python-google-nest-sdm/blob/main/google_nest_sdm/diagnostics.py This is an initial pass to add a few initial example metrics for MQTT, but we can add more as we need fine grained details in diagnostics.
aeded4f to
a3518ca
Compare
Lash-L
approved these changes
Dec 17, 2025
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.
Add a generic library that can be used to track counters, or elapsed time (e.g. how long it takes on average to connect to mqtt). This is a copy of https://github.com/allenporter/python-google-nest-sdm/blob/main/google_nest_sdm/diagnostics.py
This is an initial pass to add a few initial example metrics for MQTT, but we can add more as we need fine grained details in diagnostics. This will become more important with lazy device initialization as users may not see explicit error messages from the integration and we'll want them to provide diagnostics.