feat(health): allow excluding noisy LogServices in periodic log collection#3349
feat(health): allow excluding noisy LogServices in periodic log collection#3349cdraman wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (3)
Summary by CodeRabbit
WalkthroughPeriodic log collection now accepts configurable, case-sensitive substring filters for Redfish ChangesPeriodic LogService Exclusion
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PeriodicLogConfig
participant spawn_generic_redfish_collectors
participant LogsCollector
participant RedfishBMC
PeriodicLogConfig->>spawn_generic_redfish_collectors: provide exclude_services
spawn_generic_redfish_collectors->>LogsCollector: create LogsCollectorConfig
LogsCollector->>RedfishBMC: discover LogServices
LogsCollector->>LogsCollector: filter matching OData IDs
LogsCollector-->>LogsCollector: log total and excluded service counts
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/health/src/collectors/logs/periodic.rs (1)
427-481: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPrefer
check_valuesover ad-hoc#[test]functions for this matcher.
service_is_excludedis a pure validator with two inputs (pattern list, service id) and a boolean output — exactly the case the style guide calls out for table-driven tests. As per coding guidelines, "Usecheck_cases/check_valuesdirectly when a macro would obscure a table with several inputs or several expected fields per row in table-driven tests." A singlecheck_valuestable covering all five current scenarios (empty list, substring match, non-match, multi-pattern, case sensitivity) would replace the five separate#[test]functions with one enumerable table and make it trivial to add future cases.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/health/src/collectors/logs/periodic.rs` around lines 427 - 481, Replace the five ad-hoc tests in the tests module with one table-driven check_values test covering empty exclusions, substring matches, non-matches, multiple patterns, and case sensitivity. Keep each case’s pattern list, service ID, and expected boolean explicit, and use the project’s existing check_values convention while continuing to exercise service_is_excluded.Sources: Coding guidelines, Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/health/src/collectors/logs/periodic.rs`:
- Around line 417-425: Update service_is_excluded to ignore empty
exclude_services patterns before performing substring matching, ensuring only
non-empty patterns are checked against service_id.
---
Nitpick comments:
In `@crates/health/src/collectors/logs/periodic.rs`:
- Around line 427-481: Replace the five ad-hoc tests in the tests module with
one table-driven check_values test covering empty exclusions, substring matches,
non-matches, multiple patterns, and case sensitivity. Keep each case’s pattern
list, service ID, and expected boolean explicit, and use the project’s existing
check_values convention while continuing to exercise service_is_excluded.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 515f362c-71e1-4934-99a0-26ac9837da9e
📒 Files selected for processing (5)
crates/health/example/config.bmc-mock-periodic.tomlcrates/health/example/config.example.tomlcrates/health/src/collectors/logs/periodic.rscrates/health/src/config.rscrates/health/src/discovery/spawn.rs
…ction The periodic log collector enumerates and drains every Redfish LogService under Managers/Chassis/Systems. On real BMCs this includes the bmcweb "Journal" HTTP-access log, which is high-volume noise and self-referential: our own Redfish polling generates Journal entries that the next poll re-collects, so volume grows as a function of our own polling and can drown the real signal (e.g. GPU XID events). Add a `collectors.logs.periodic.exclude_services` option: a list of substrings matched against each LogService odata id; matching services are skipped during discovery. Empty (default) preserves current behavior. Periodic mode only — SSE never enumerates LogServices. - config: new `exclude_services: Vec<String>` on PeriodicLogConfig (#[serde(default)], empty default; backward compatible) - periodic: apply the filter in discover_log_services() and report an `excluded_services` count; extract the predicate into a testable free function with unit tests - spawn: thread the field into the collector config - examples: document the option in config.example.toml and add a runnable config.bmc-mock-periodic.toml demonstrating exclude_services Signed-off-by: Dasa Chandramouli <dchandramoul@nvidia.com>
|
Lets make exclude Journal by default, seems like this behavior is not desired in vast majority of cases |
| # Typically used to drop the bmcweb "Journal" HTTP-access log (high-volume noise, | ||
| # and self-referential since polling generates Journal entries). Empty (default) | ||
| # collects from every discovered LogService. Periodic mode only. | ||
| exclude_services = [] |
There was a problem hiding this comment.
Need to also define this config attrubute on L198.
Auto mode accepts both sse and periodic config variables for fallback behavior
When
forge-hw-healthruns in periodic log collection mode, it enumeratesevery Redfish LogService on the BMC — including the bmcweb Journal, which
is the BMC web server's own HTTP access log.
This creates a self-reinforcing noise loop: every Redfish poll we make is
itself recorded as a Journal entry. The next poll collects those entries,
which generates more entries. Volume grows as a function of our own polling
rate, not real hardware events, drowning out meaningful signal like GPU XID
faults and CPER records.
Add
exclude_servicestocollectors.logs.periodic— a list of substringsmatched against each LogService
@odata.id. Matching services are skippedat discovery time before any entries are fetched.
Related issues
Closes #3344
Type of Change
Breaking Changes
Testing
Additional Notes