Skip to content

Conversation

@ilyam8
Copy link
Member

@ilyam8 ilyam8 commented Dec 14, 2025

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.

  • Bug Fixes
    • Use pointer fields in stationStats and omit metrics when values are missing.
    • parseIwStationStatistics no longer errors; unknown/malformed lines (e.g., “tx bitrate: (unknown)”) are ignored.
    • Compute average_signal and per-client bitrates only when clients > 0 and values exist.
    • Updated tests and fixture to cover unknown tx bitrate; adjusted expected metrics.

Written for commit 21f7ed6. Summary will update automatically on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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

Copy link
Contributor

Copilot AI left a 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.

@ilyam8 ilyam8 closed this Dec 14, 2025
@ilyam8 ilyam8 reopened this Dec 14, 2025
@ilyam8 ilyam8 enabled auto-merge (squash) December 14, 2025 11:48
@ilyam8 ilyam8 merged commit d91ea65 into netdata:master Dec 14, 2025
227 of 236 checks passed
@ilyam8 ilyam8 deleted the fix-go.d-ap-unknown-value branch December 14, 2025 13:34
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Dec 15, 2025
@stelfrag stelfrag mentioned this pull request Dec 15, 2025
Ferroin pushed a commit that referenced this pull request Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/collectors Everything related to data collection area/go collectors/go.d

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Access Point chart doesn't show due to text parsing error

2 participants