From 17164989ad3aa3e6be0e54f42fa5e1e2aa9633be Mon Sep 17 00:00:00 2001 From: mphanias Date: Thu, 15 Aug 2024 23:44:03 +0530 Subject: [PATCH 1/7] fixed code to handle metric-type of sysinfo --- configs/gauge_stats_list.toml | 9 ++++++++- internal/pkg/statprocessors/utils.go | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configs/gauge_stats_list.toml b/configs/gauge_stats_list.toml index 3a3fb1c4..1234b0c8 100644 --- a/configs/gauge_stats_list.toml +++ b/configs/gauge_stats_list.toml @@ -255,5 +255,12 @@ namespace_gauge_stats =[ # System Info Gauge metrics list # system_info_gauge_stats = [ - "", + "filefd_allocated", + "stats_shmem_bytes", + "swap_cached_bytes", + "tcp_activeopens", + "tcp_currestab", + "tcp_retranssegs", + "receive_bytes_total", + "transfer_bytes_total", ] diff --git a/internal/pkg/statprocessors/utils.go b/internal/pkg/statprocessors/utils.go index 114aced6..841fcfd5 100644 --- a/internal/pkg/statprocessors/utils.go +++ b/internal/pkg/statprocessors/utils.go @@ -143,6 +143,12 @@ 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_") { + fmt.Println("\t given stat ", pStat, " is a sysinfo... checking against gauge list. ", config.GaugeStatHandler.SysInfoStats[pStat]) + return config.GaugeStatHandler.SysInfoStats[pStat] + } + return false } From 00475144b819a08ac8d6abcf64eac8b7a77da830 Mon Sep 17 00:00:00 2001 From: mphanias Date: Thu, 15 Aug 2024 23:48:09 +0530 Subject: [PATCH 2/7] added debug print --- internal/pkg/statprocessors/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/pkg/statprocessors/utils.go b/internal/pkg/statprocessors/utils.go index 841fcfd5..c22e2e77 100644 --- a/internal/pkg/statprocessors/utils.go +++ b/internal/pkg/statprocessors/utils.go @@ -145,7 +145,7 @@ func isGauge(pContextType commons.ContextType, pStat string) bool { // any sysinfo_ check if it exists in gauge_stats_list.toml if strings.Contains(strings.ToLower(string(pContextType)), "sysinfo_") { - fmt.Println("\t given stat ", pStat, " is a sysinfo... checking against gauge list. ", config.GaugeStatHandler.SysInfoStats[pStat]) + fmt.Println("\t *** given stat ", pStat, " is a sysinfo... checking against gauge list. ", config.GaugeStatHandler.SysInfoStats[pStat]) return config.GaugeStatHandler.SysInfoStats[pStat] } From fc8453dc09bee509cdbd9d53f4d4bb72b550b10c Mon Sep 17 00:00:00 2001 From: mphanias Date: Thu, 15 Aug 2024 23:57:01 +0530 Subject: [PATCH 3/7] fixed gauge stat list --- configs/gauge_stats_list.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/gauge_stats_list.toml b/configs/gauge_stats_list.toml index 1234b0c8..c4ef5a3b 100644 --- a/configs/gauge_stats_list.toml +++ b/configs/gauge_stats_list.toml @@ -255,9 +255,9 @@ namespace_gauge_stats =[ # System Info Gauge metrics list # system_info_gauge_stats = [ - "filefd_allocated", - "stats_shmem_bytes", - "swap_cached_bytes", + "allocated", + "shmem_bytes", + "cached_bytes", "tcp_activeopens", "tcp_currestab", "tcp_retranssegs", From 416933d4ff3f2e92b3c5cc4044274609bc9bfcbb Mon Sep 17 00:00:00 2001 From: mphanias Date: Thu, 15 Aug 2024 23:59:56 +0530 Subject: [PATCH 4/7] updated guage stat list --- configs/gauge_stats_list.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/gauge_stats_list.toml b/configs/gauge_stats_list.toml index c4ef5a3b..da00ec35 100644 --- a/configs/gauge_stats_list.toml +++ b/configs/gauge_stats_list.toml @@ -257,7 +257,7 @@ namespace_gauge_stats =[ system_info_gauge_stats = [ "allocated", "shmem_bytes", - "cached_bytes", + "swap_cached_bytes", "tcp_activeopens", "tcp_currestab", "tcp_retranssegs", From 0c6390f1875dfed5ba17ac7be896ebe27c5cf796 Mon Sep 17 00:00:00 2001 From: mphanias Date: Fri, 16 Aug 2024 00:01:14 +0530 Subject: [PATCH 5/7] removed unnecessary prints --- internal/pkg/statprocessors/utils.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/pkg/statprocessors/utils.go b/internal/pkg/statprocessors/utils.go index c22e2e77..96842c45 100644 --- a/internal/pkg/statprocessors/utils.go +++ b/internal/pkg/statprocessors/utils.go @@ -145,7 +145,6 @@ func isGauge(pContextType commons.ContextType, pStat string) bool { // any sysinfo_ check if it exists in gauge_stats_list.toml if strings.Contains(strings.ToLower(string(pContextType)), "sysinfo_") { - fmt.Println("\t *** given stat ", pStat, " is a sysinfo... checking against gauge list. ", config.GaugeStatHandler.SysInfoStats[pStat]) return config.GaugeStatHandler.SysInfoStats[pStat] } From 3183231a54cecdbff4647375db39d3343898cd0e Mon Sep 17 00:00:00 2001 From: mphanias Date: Fri, 16 Aug 2024 00:03:21 +0530 Subject: [PATCH 6/7] removed dead code --- internal/pkg/statprocessors/utils.go | 57 ---------------------------- 1 file changed, 57 deletions(-) diff --git a/internal/pkg/statprocessors/utils.go b/internal/pkg/statprocessors/utils.go index 96842c45..3293e561 100644 --- a/internal/pkg/statprocessors/utils.go +++ b/internal/pkg/statprocessors/utils.go @@ -176,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") From eb0c9f8bff0a007c84a41ce025637efdc2612aa8 Mon Sep 17 00:00:00 2001 From: mphanias Date: Tue, 20 Aug 2024 23:46:50 +0530 Subject: [PATCH 7/7] OM-204 - review feedback removed receive bytes, total bytes and retransmission segs from gauge list --- configs/gauge_stats_list.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/configs/gauge_stats_list.toml b/configs/gauge_stats_list.toml index da00ec35..b59b5469 100644 --- a/configs/gauge_stats_list.toml +++ b/configs/gauge_stats_list.toml @@ -260,7 +260,4 @@ system_info_gauge_stats = [ "swap_cached_bytes", "tcp_activeopens", "tcp_currestab", - "tcp_retranssegs", - "receive_bytes_total", - "transfer_bytes_total", ]