diff --git a/configs/gauge_stats_list.toml b/configs/gauge_stats_list.toml index 3a3fb1c..b59b546 100644 --- a/configs/gauge_stats_list.toml +++ b/configs/gauge_stats_list.toml @@ -255,5 +255,9 @@ namespace_gauge_stats =[ # System Info Gauge metrics list # system_info_gauge_stats = [ - "", + "allocated", + "shmem_bytes", + "swap_cached_bytes", + "tcp_activeopens", + "tcp_currestab", ] diff --git a/internal/pkg/statprocessors/utils.go b/internal/pkg/statprocessors/utils.go index 114aced..3293e56 100644 --- a/internal/pkg/statprocessors/utils.go +++ b/internal/pkg/statprocessors/utils.go @@ -143,6 +143,11 @@ func isGauge(pContextType commons.ContextType, pStat string) bool { return config.GaugeStatHandler.XdrStats[pStat] } + // any sysinfo_ check if it exists in gauge_stats_list.toml + if strings.Contains(strings.ToLower(string(pContextType)), "sysinfo_") { + return config.GaugeStatHandler.SysInfoStats[pStat] + } + return false } @@ -171,63 +176,6 @@ func GetMetricType(pContext commons.ContextType, pRawMetricName string) commons. return commons.MetricTypeCounter } -// // Filter metrics -// // Runs the raw metrics through allowlist first and the resulting metrics through blocklist -// func GetFilteredMetrics(rawMetrics map[string]commons.MetricType, allowlist []string, allowlistEnabled bool, blocklist []string) map[string]commons.MetricType { -// filteredMetrics := filterAllowedMetrics(rawMetrics, allowlist, allowlistEnabled) -// filterBlockedMetrics(filteredMetrics, blocklist) - -// return filteredMetrics -// } - -// // Filter metrics based on configured allowlist. -// func filterAllowedMetrics(rawMetrics map[string]commons.MetricType, allowlist []string, allowlistEnabled bool) map[string]commons.MetricType { -// if !allowlistEnabled { -// return rawMetrics -// } - -// filteredMetrics := make(map[string]commons.MetricType) - -// for _, stat := range allowlist { -// if GlobbingPattern.MatchString(stat) { -// ge := glob.MustCompile(stat) - -// for k, v := range rawMetrics { -// if ge.Match(k) { -// filteredMetrics[k] = v -// } -// } -// } else { -// if val, ok := rawMetrics[stat]; ok { -// filteredMetrics[stat] = val -// } -// } -// } - -// return filteredMetrics -// } - -// // Filter metrics based on configured blocklist. -// func filterBlockedMetrics(filteredMetrics map[string]commons.MetricType, blocklist []string) { -// if len(blocklist) == 0 { -// return -// } - -// for _, stat := range blocklist { -// if GlobbingPattern.MatchString(stat) { -// ge := glob.MustCompile(stat) - -// for k := range filteredMetrics { -// if ge.Match(k) { -// delete(filteredMetrics, k) -// } -// } -// } else { -// delete(filteredMetrics, stat) -// } -// } -// } - func BuildVersionGreaterThanOrEqual(rawMetrics map[string]string, ref string) (bool, error) { if len(rawMetrics["build"]) == 0 { return false, fmt.Errorf("couldn't get build version")