Skip to content

Commit

Permalink
OM-204 - Updated gauge list for sysinfo metrics (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
mphanias authored Aug 21, 2024
1 parent 4958dd7 commit ba9d07b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 58 deletions.
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

0 comments on commit ba9d07b

Please sign in to comment.