-
Notifications
You must be signed in to change notification settings - Fork 1
Add sensor log monitoring with improved configuration support #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add sensor log monitoring with improved configuration support #388
Conversation
…xisting plugin configs. New issue raised for DRYing the config validation
…iguration flexibility - Introduced `SensorLogMonitorState` model for tracking monitoring state. - Added monitoring job to alert on missing sensor logs based on configurable thresholds. - Updated `SmibhidSensorPluginConfig` to include monitoring settings. - Enhanced utility module with `get_humanized_timedelta` for user-friendly time outputs. - Adjusted plugin to conditionally enable or disable monitoring based on configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Implements sensor log monitoring functionality with configurable alerts and improves configuration validation across the codebase.
- Added monitoring job to detect when sensor logs are missing beyond configurable thresholds
- Enhanced configuration system with better error handling and validation
- Introduced timezone-aware database operations for improved reliability
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
src/smib/utilities/init.py | Adds humanized time delta formatting utility |
src/smib/plugins/lifecycle_manager.py | Enhanced plugin registration error handling for configuration failures |
src/smib/db/manager.py | Enables timezone-aware MongoDB operations |
src/smib/config/_env_base_settings.py | Adds enum parsing and none string handling |
src/smib/config/init.py | Makes validation error formatter public and updates signature |
src/plugins/space/spacestate/config.py | Adds configuration validation with proper error handling |
src/plugins/space/smibhid/sensor/models.py | Adds monitoring state model and latest log query method |
src/plugins/space/smibhid/sensor/config.py | New configuration class for sensor monitoring settings |
src/plugins/space/smibhid/sensor/init.py | Implements scheduled sensor log monitoring with Slack alerts |
src/plugins/space/smibhid/init.py | Updates plugin registration to include scheduler interface |
SETTINGS.md | Documents new sensor monitoring configuration options |
README.md | Updates plugin description to mention monitoring feature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@sjefferson99 Ok, I've updated as per the GH Copilot review - all made sense! |
@sam57719 Code looks good bar the comment above. I will pull onto smib-dev and confirm I can get it to build and trigger warnings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor of code block in comment.
…dability and reuse - Extracted monitoring logic into helper functions: `_log_monitoring_settings`, `_fetch_latest_log`, `_compute_monitor_flags`, `_send_alert`, and `_update_monitor_state`. - Streamlined sensor monitor setup with `setup_monitor_job` and `setup_routes` for clearer structure. - Improved separation of concerns for better maintainability.
Pushed a refactored version |
…ved-within-x-minutes
…ved-within-x-minutes
SensorLogMonitorState
model to track the state of sensor log monitoring.SmibhidSensorPluginConfig
to include new monitoring options. (See SETTINGS.md)get_humanized_timedelta
function for human-readable time differences.tz_aware=True
forAsyncMongoClient
to ensure timezone-aware database operations.