improve(go.d/snmp profiles): simplify _generic-if.yaml and add interface type tags#20505
Merged
ilyam8 merged 2 commits intonetdata:masterfrom Jun 17, 2025
Merged
improve(go.d/snmp profiles): simplify _generic-if.yaml and add interface type tags#20505ilyam8 merged 2 commits intonetdata:masterfrom
ilyam8 merged 2 commits intonetdata:masterfrom
Conversation
Ancairon
previously approved these changes
Jun 17, 2025
9fcdc68 to
f1e119d
Compare
f1e119d to
ddf0083
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR streamlines the SNMP interface profiles by removing explicit metric types and tag blocks in the YAML, adds a new mapping_ref mechanism to tag interface types, and implements runtime enrichment using a shared ifType mapping.
- Infer metric types and tags directly in
_generic-if.yamlinstead of repeating blocks - Introduce a global
sharedMappings.ifTypemap andenrichProfilesto applymapping_ref - Extend
MetricTagConfigto supportmapping_refin the Go data model
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/go/plugin/go.d/config/go.d/snmp.profiles/default/_generic-if.yaml | Removed explicit metric_type and metric_tags, added mapping_ref for interface type |
| src/go/plugin/go.d/collector/snmp/ddsnmp/shared.go | Added sharedMappings.ifType map with SNMP interface type codes |
| src/go/plugin/go.d/collector/snmp/ddsnmp/profile.go | Integrated enrichProfiles to populate tag mappings based on mapping_ref |
| src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/metrics.go | Added MappingRef field to MetricTagConfig |
Comments suppressed due to low confidence (2)
src/go/plugin/go.d/collector/snmp/ddsnmp/profile.go:263
- The new
enrichProfilesfunction and its integration inFindProfileslack unit tests. Please add tests to verify thatmapping_reftags are populated correctly and that profiles withoutmapping_refremain unchanged.
func enrichProfiles(profiles []*Profile) {
src/go/plugin/go.d/collector/snmp/ddsnmp/ddprofiledefinition/metrics.go:117
- The new
MappingReffield extends the public API and should be documented in the project's SNMP profile schema docs or examples. Please update relevant documentation to explain how to usemapping_ref.
MappingRef string `yaml:"mapping_ref,omitempty" json:"mapping_ref,omitempty"`
Ancairon
approved these changes
Jun 17, 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?