-
Notifications
You must be signed in to change notification settings - Fork 6.3k
fix(go.d/ap): handle unknown values in station statistics gracefully #21461
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
Conversation
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.
1 issue found across 3 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/go/plugin/go.d/collector/ap/testdata/station_dump.txt">
<violation number="1" location="src/go/plugin/go.d/collector/ap/testdata/station_dump.txt:60">
P3: Inconsistent whitespace: existing stations use tabs for indentation, but this new entry uses spaces. Consider using tabs to match the existing test data format for consistency.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
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
This PR fixes issue #21460 by updating the ap collector to gracefully handle unknown or unparseable values in wireless station statistics, preventing collection failures when fields like "tx bitrate" contain "(unknown)" values.
Key Changes:
- Modified stationStats struct to use pointer fields, enabling distinction between missing values (nil) and actual zero values
- Removed error return from parseIwStationStatistics, allowing it to skip unparseable fields and continue processing
- Added conditional metric publishing that only includes metrics with valid values
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/go/plugin/go.d/collector/ap/testdata/station_dump.txt | Added a third station with "tx bitrate: (unknown)" to test graceful handling of unparseable values |
| src/go/plugin/go.d/collector/ap/collector_test.go | Updated expected metrics to reflect 3 clients and recalculated averages (average_signal, bitrates) |
| src/go/plugin/go.d/collector/ap/collect.go | Refactored stationStats to use pointers, removed error handling from parsing, added helper methods for accumulating stats, and implemented nil-checks when publishing metrics |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…etdata#21461) (cherry picked from commit d91ea65)
Summary
Fixes: #21460
This PR updates the ap collector to handle parse errors gracefully when
collecting station statistics.
Test Plan
Additional Information
For users: How does this change affect me?
Summary by cubic
Handle unknown values in iw station statistics without failing. The ap collector now skips unparseable fields and publishes only the metrics it can compute.
Written for commit 21f7ed6. Summary will update automatically on new commits.