Closed mitchellwrosen closed 5 years ago
Update: the mean and variance are NaN
, not infinity, if that helps.
Huh, this behavior is trivial for me to reproduce.
{-# language OverloadedStrings #-}
import System.Metrics
import System.Metrics.Distribution as Distribution
main :: IO ()
main = do
s <- newStore
d <- createDistribution "foo" s
Distribution.add d 1
Distribution.read d >>= print
When run with one capabilty, this prints:
Stats {mean = 1.0, variance = 0.0, count = 1, sum = 1.0, min = 0.0, max = 1.0}
But with -N2
:
Stats {mean = NaN, variance = NaN, count = 1, sum = 1.0, min = 0.0, max = 1.0}
Ah, that last data point is not interesting, just a race condition. I'm still trying to reproduce the NaN
from a long-running EKG store.
Ok, I think I understand what's happening. The distribution has 8 stripes that are combined together. If any of the stripes have not accumulated a write, the mean will be calculated as 0/0 = nan
.
Fixed by #25.
I'm seeing a distribution with
N/A
variance and mean (the json isnull
). I assume this is due to a division by 0, but I can't see how that's possible. I'm only using theadd
function which increments the count by 1.Any idea what might be the cause? Has this been reported before?
Thanks :)