@cryptotaxi247 / netdata / commits / e6904b660

chore(go.d/snmp-profiles): remove unsupported constant_value_one metrics (#20519)

Ilya Mashchenko committed Jun 18, 2025 at 22:02 UTC e6904b6609d3c1e940fd9ba08dfafac4c0efbd40
1 file changed +22
src/go/plugin/go.d/collector/snmp/ddsnmp/profile.go
+22
@@ -171,6 +171,26 @@ func (p *Profile) validate() error {
171 return nil
172 }
173
174 +func (p *Profile) removeConstantMetrics() {
175 + if p.Definition == nil {
176 + return
177 + }
178 +
179 + p.Definition.Metrics = slices.DeleteFunc(p.Definition.Metrics, func(m ddprofiledefinition.MetricsConfig) bool {
180 + if m.IsScalar() && m.Symbol.ConstantValueOne {
181 + return true
182 + }
183 +
184 + if m.IsColumn() {
185 + m.Symbols = slices.DeleteFunc(m.Symbols, func(s ddprofiledefinition.SymbolConfig) bool {
186 + return s.ConstantValueOne
187 + })
188 + }
189 +
190 + return m.IsColumn() && len(m.Symbols) == 0
191 + })
192 +}
193 +
194 func loadProfiles(dirpath string) ([]*Profile, error) {
195 var profiles []*Profile
196
@@ -193,6 +213,8 @@ func loadProfiles(dirpath string) ([]*Profile, error) {
213 return nil
214 }
215
216 + profile.removeConstantMetrics()
217 +
218 profiles = append(profiles, profile)
219 return nil
220 }); err != nil {