You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
f.Var(&cfg.Resources, "resource-monitor.resources", "Comma-separated list of resources to monitor. "+
22
+
"Supported values are cpu and heap, which tracks metrics from github.com/prometheus/procfs and runtime/metrics "+
23
+
"that are close estimates. Empty string to disable.")
24
+
f.DurationVar(&cfg.Interval, "resource-monitor.interval", 100*time.Millisecond, "Update interval of resource monitor. Must be greater than 0.")
25
+
f.DurationVar(&cfg.CPURateInterval, "resource-monitor.cpu-rate-interval", time.Minute, "Interval to calculate average CPU rate. Must be greater than resource monitor interval.")
26
+
}
27
+
28
+
func (cfg*ResourceMonitor) Validate() error {
29
+
for_, r:=rangecfg.Resources {
30
+
switchresource.Type(r) {
31
+
caseresource.CPU, resource.Heap:
32
+
default:
33
+
iflen(r) >0 {
34
+
returnfmt.Errorf("unsupported resource type to monitor: %s", r)
35
+
}
36
+
}
37
+
}
38
+
39
+
ifcfg.Interval<=0 {
40
+
returnfmt.Errorf("resource monitor interval must be greater than zero")
41
+
}
42
+
43
+
ifcfg.CPURateInterval<cfg.Interval {
44
+
returnfmt.Errorf("resource monitor cpu rate interval cannot be smaller than resource monitor interval")
0 commit comments