eric / metriks

An experimental library to instrument ruby
MIT License
478 stars 51 forks source link

Check for infinite sample keys #18

Closed lmarburger closed 12 years ago

lmarburger commented 12 years ago

Fixes #13. Here's how I reproduced it.

sample = Metriks::ExponentiallyDecayingSample.new(Metriks::Histogram::DEFAULT_SAMPLE_SIZE, Metriks::Histogram::DEFAULT_ALPHA)

# Pretend the process has been running for a while without resampling.
sample.instance_variable_set(:@start_time, Time.new(2000))
sample.instance_variable_get(:@next_scale_time).value = Time.new(2000) + Metriks::ExponentiallyDecayingSample::RESCALE_THRESHOLD

sample.update 42
#=> warn: ExponentiallyDecayingSample found a new_key of NaN. key: Infinity old_start_time: 946702800.0 start_time: 1341235050.329391
eric commented 12 years ago

:heart: