Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OM-204 - sysinfo metrics type is corrected #127

Merged
merged 7 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion configs/gauge_stats_list.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
62 changes: 5 additions & 57 deletions internal/pkg/statprocessors/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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")
Expand Down
Loading