chore(go.d/snmp): add collection stats - #21409
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive collection statistics to the SNMP collector to improve observability and debugging capabilities.
- Introduces
CollectionStatsstructure to track timing, SNMP operations, metric counts, cache performance, and errors for each profile collection cycle - Refactors internal collector methods from exported to unexported (
Collect→collect) for better encapsulation - Threads stats tracking through all collection phases (scalar, table, virtual metrics)
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/go/plugin/go.d/collector/snmp/ddsnmp/metric.go |
Adds CollectionStats and related stats types (TimingStats, SNMPOperationStats, MetricCountStats, TableCacheStats, ErrorStats) with comprehensive documentation |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector.go |
Integrates stats collection, refactors profileState to use nested cache struct, measures timing for each collection phase |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_scalar.go |
Converts Collect to unexported collect(), adds stats parameter, tracks SNMP GET operations, missing OIDs, and processing errors |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_table.go |
Converts Collect to unexported collect(), tracks SNMP walks, cache hits/misses, tables walked/cached, row counts, and errors throughout the collection pipeline |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_vmetrics.go |
Converts Collect to unexported collect(), removes unnecessary line break in function signature |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_global_tags.go |
Converts Collect to unexported collect() for consistency |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_device_meta.go |
Converts Collect to unexported collect() for consistency |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_test.go |
Adds comprehensive test validating stats snapshot for a simple profile with scalar, table, and virtual metrics |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_scalar_test.go |
Updates test to use new collect() signature with stats parameter |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_table_test.go |
Updates test to use new collect() signature with stats parameter |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_vmetrics_test.go |
Updates test to use new collect() method name |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_global_tags_test.go |
Updates test to use new collect() method name |
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector_device_meta_test.go |
Updates test to use new collect() method name |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
vkalintiris
approved these changes
Dec 5, 2025
Merged
stelfrag
pushed a commit
to stelfrag/netdata
that referenced
this pull request
Dec 6, 2025
(cherry picked from commit d763e6f)
Ferroin
pushed a commit
that referenced
this pull request
Dec 15, 2025
(cherry picked from commit d763e6f)
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
Test Plan
Additional Information
For users: How does this change affect me?
Summary by cubic
Add per-collection stats to the SNMP go.d collector and expose them as per-profile charts. Stats track timing, SNMP ops, cache performance, errors, and metric totals, and are returned in ProfileMetrics.
New Features
Refactors
Written for commit c6d07d8. Summary will update automatically on new commits.