-
Notifications
You must be signed in to change notification settings - Fork 6.3k
chore(go.d/snmp): add collection stats #21409
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.
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.
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
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.
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collector.go
Outdated
Show resolved
Hide resolved
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.
No issues found across 17 files
(cherry picked from commit d763e6f)
(cherry picked from commit d763e6f)
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.