-
Notifications
You must be signed in to change notification settings - Fork 205
added excludes option to edr monitor #1945
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
added excludes option to edr monitor #1945
Conversation
|
👋 @ofek1weiss |
WalkthroughA new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant FiltersSchema
User->>CLI: Run monitor command with --filters and/or --excludes
CLI->>FiltersSchema: from_cli_params(filters, excludes)
FiltersSchema->>FiltersSchema: Parse include (IS) and exclude (IS_NOT) filters
FiltersSchema-->>CLI: Return FiltersSchema instance
CLI-->>User: Display filtered monitoring results
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
elementary/monitor/data_monitoring/schema.py (1)
184-184: Consider Python version compatibility for type annotations.The type annotation
list[tuple[str, FilterType]]requires Python 3.9+. If this project supports older Python versions, consider usingList[Tuple[str, FilterType]]from thetypingmodule instead.- all_filters: list[tuple[str, FilterType]] = [] + all_filters: List[Tuple[str, FilterType]] = []
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
elementary/monitor/cli.py(3 hunks)elementary/monitor/data_monitoring/schema.py(5 hunks)tests/unit/monitor/data_monitoring/test_filters_schema.py(19 hunks)
🧰 Additional context used
🪛 Pylint (3.3.7)
elementary/monitor/data_monitoring/schema.py
[refactor] 181-181: Too many local variables (16/15)
(R0914)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: code-quality
🔇 Additional comments (4)
elementary/monitor/cli.py (1)
272-280: LGTM! Well-structured excludes option implementation.The new
--excludesCLI option follows the established patterns:
- Mirrors the
--filtersoption structure appropriately- Uses a clear alias (
-ex) and comprehensive help text- Correctly integrates with the existing filtering logic
The function signature and conditional logic updates are properly coordinated.
Also applies to: 317-317, 357-358
elementary/monitor/data_monitoring/schema.py (1)
181-189: Excellent implementation of combined inclusion/exclusion filtering.The logic correctly:
- Combines both filter types with appropriate
FilterTypeenum values- Maintains the existing processing loop structure while adding type awareness
- Preserves default status filters when only exclusion filters are provided (lines 252-253)
This ensures that users can mix inclusion and exclusion filters effectively while maintaining backward compatibility.
Also applies to: 199-253
tests/unit/monitor/data_monitoring/test_filters_schema.py (2)
8-9: Good mechanical updates to accommodate new method signature.All existing test calls are correctly updated to include the
cli_excludesparameter, maintaining test compatibility with the updatedfrom_cli_paramsmethod signature.Also applies to: 22-23, 35-36, 48-49, 64-65, 77-78, 90-91, 106-107, 119-120, 132-133, 149-150, 154-155, 159-160, 163-164, 173-174, 183-184, 197-198, 202-203, 207-208, 211-212, 224-225, 237-238, 253-254, 267-268
281-297: Excellent test coverage for exclude functionality.The new tests effectively validate:
test_exclude_filters: Mixed inclusion/exclusion filters with correctFilterTypeassignment (ISvsIS_NOT)test_exclude_statuses_filters: Edge case where only exclusion filters are provided, ensuring default status filters are preservedThese tests provide comprehensive coverage of the new exclude functionality and important edge cases.
Also applies to: 299-313
Co-authored-by: Mika Kerman <[email protected]>
null
Summary by CodeRabbit
New Features
Bug Fixes
Tests