fix(go.d/ap): handle unknown values in station statistics gracefully - #21461
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
Contributor
There was a problem hiding this comment.
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.
stelfrag
approved these changes
Dec 14, 2025
stelfrag
pushed a commit
to stelfrag/netdata
that referenced
this pull request
Dec 15, 2025
…etdata#21461) (cherry picked from commit d91ea65)
Merged
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.
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.