chore(go.d/ddsnmp): add index-based tags and cross-table index transformation support#20482
Merged
ilyam8 merged 5 commits intonetdata:masterfrom Jun 15, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for index-based tags and cross‐table index transformation in the SNMP collector by refactoring the table walking and processing logic.
- Removed the previous table-skipping logic for tags with index transformations.
- Updated the processTableData function to apply index transformations and handle index‐based tags.
- Added helper functions (getIndexPosition and applyIndexTransform) and refined SNMP walk processing.
Comments suppressed due to low confidence (2)
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collect_table.go:266
- [nitpick] Ensure that the 'ternary' function is defined or imported in the codebase, as Go does not provide a built-in ternary operator. Consider refactoring this into a clear if/else block if there is any ambiguity.
tagName := ternary(tagCfg.Tag != "", tagCfg.Tag, fmt.Sprintf("index%d", tagCfg.Index))
src/go/plugin/go.d/collector/snmp/ddsnmp/ddsnmpcollector/collect_table.go:470
- The revised snmpWalk function no longer logs each non-data PDU as missing; instead, it marks the entire oid as missing when no valid PDUs are found. Please confirm that this logging change is intentional for diagnostic purposes.
if isPduWithData(pdu) {
sashwathn
approved these changes
Jun 15, 2025
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?