mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-04-17 10:25:56 +02:00
Generalize nan_to_zero option to invalid_to_zero including +Inf,+Inf and NaN
This commit is contained in:
parent
e991c4c3b2
commit
dc18714d83
@ -94,7 +94,7 @@ type LikwidCollectorConfig struct {
|
|||||||
Eventsets []LikwidCollectorEventsetConfig `json:"eventsets"`
|
Eventsets []LikwidCollectorEventsetConfig `json:"eventsets"`
|
||||||
Metrics []LikwidCollectorMetricConfig `json:"globalmetrics,omitempty"`
|
Metrics []LikwidCollectorMetricConfig `json:"globalmetrics,omitempty"`
|
||||||
ForceOverwrite bool `json:"force_overwrite,omitempty"`
|
ForceOverwrite bool `json:"force_overwrite,omitempty"`
|
||||||
NanToZero bool `json:"nan_to_zero,omitempty"`
|
InvalidToZero bool `json:"invalid_to_zero,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LikwidCollector struct {
|
type LikwidCollector struct {
|
||||||
@ -449,7 +449,10 @@ func (m *LikwidCollector) calcEventsetMetrics(group int, interval time.Duration,
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
m.mresults[group][tid][metric.Name] = value
|
m.mresults[group][tid][metric.Name] = value
|
||||||
if m.config.NanToZero && math.IsNaN(value) {
|
if m.config.InvalidToZero && math.IsNaN(value) {
|
||||||
|
value = 0.0
|
||||||
|
}
|
||||||
|
if m.config.InvalidToZero && math.IsInf(value, 0) {
|
||||||
value = 0.0
|
value = 0.0
|
||||||
}
|
}
|
||||||
// Now we have the result, send it with the proper tags
|
// Now we have the result, send it with the proper tags
|
||||||
@ -493,7 +496,10 @@ func (m *LikwidCollector) calcGlobalMetrics(interval time.Duration, output chan
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
m.gmresults[tid][metric.Name] = value
|
m.gmresults[tid][metric.Name] = value
|
||||||
if m.config.NanToZero && math.IsNaN(value) {
|
if m.config.InvalidToZero && math.IsNaN(value) {
|
||||||
|
value = 0.0
|
||||||
|
}
|
||||||
|
if m.config.InvalidToZero && math.IsInf(value, 0) {
|
||||||
value = 0.0
|
value = 0.0
|
||||||
}
|
}
|
||||||
// Now we have the result, send it with the proper tags
|
// Now we have the result, send it with the proper tags
|
||||||
|
@ -9,7 +9,7 @@ The `likwid` configuration consists of two parts, the "eventsets" and "globalmet
|
|||||||
|
|
||||||
Additional options:
|
Additional options:
|
||||||
- `force_overwrite`: Same as setting `LIKWID_FORCE=1`. In case counters are already in-use, LIKWID overwrites their configuration to do its measurements
|
- `force_overwrite`: Same as setting `LIKWID_FORCE=1`. In case counters are already in-use, LIKWID overwrites their configuration to do its measurements
|
||||||
- `nan_to_zero`: In some cases, the calculations result in `NaN`. With this option, all `NaN` values are replaces with `0.0`.
|
- `invalid_to_zero`: In some cases, the calculations result in `NaN` or `Inf`. With this option, all `NaN` and `Inf` values are replaces with `0.0`.
|
||||||
|
|
||||||
### Available metric scopes
|
### Available metric scopes
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user