When MongoDB freezes or restarts, do not report negative diffs
Fixes #253
This commit is contained in:
parent
2f08577967
commit
eb0a19062e
|
@ -367,7 +367,11 @@ func computeLockDiffs(prevLocks, curLocks map[string]LockUsage) []LockUsage {
|
||||||
}
|
}
|
||||||
|
|
||||||
func diff(newVal, oldVal, sampleTime int64) int64 {
|
func diff(newVal, oldVal, sampleTime int64) int64 {
|
||||||
return (newVal - oldVal) / sampleTime
|
d := newVal - oldVal
|
||||||
|
if d <= 0 {
|
||||||
|
d = newVal
|
||||||
|
}
|
||||||
|
return d / sampleTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewStatLine constructs a StatLine object from two ServerStatus objects.
|
// NewStatLine constructs a StatLine object from two ServerStatus objects.
|
||||||
|
|
Loading…
Reference in New Issue