Skip to content

Commit

Permalink
Made map and removed unnecessary property.
Browse files Browse the repository at this point in the history
  • Loading branch information
musa-asad committed Jul 16, 2024
1 parent da0a37f commit 6600ee3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"metrics": {
"metrics_collected": {
"collectd": {
"collectd_security_level": "none",
"drop_original_metrics": ["collectd_drop"]
},
"cpu": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ type translator struct {

var _ common.Translator[component.Config] = (*translator)(nil)

// Map to support dropping metrics without measurement.
var toDropMap = map[string]bool{
"collectd": true,
"statsd": true,
"ethtool": true,
}

func NewTranslator() common.Translator[component.Config] {
return NewTranslatorWithName("")
}
Expand Down Expand Up @@ -164,7 +171,7 @@ func getDropOriginalMetrics(conf *confmap.Conf) map[string]bool {
*/
if dropMetrics := common.GetArray[any](conf, dropOriginalCfgKey); dropMetrics != nil {
for _, dropMetric := range dropMetrics {
if category == "collectd" || category == "statsd" || category == "ethtool" {
if _, in := toDropMap[category]; in {
dropMetric, ok := dropMetric.(string)
if ok {
dropOriginalMetrics[dropMetric] = true
Expand Down

0 comments on commit 6600ee3

Please sign in to comment.