Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "biased" mean in "Metrics" histogram

Tags:

java

metrics

One of the properties that Codahale's "Metrics" received is "biased".
Can someone explain what does it mean?

public Histogram newHistogram(Class<?> klass,
                     String name,
                     boolean biased)
Creates a new Histogram and registers it under the given class and name.
Parameters:
klass - the class which owns the metric
name - the name of the metric
biased - whether or not the histogram should be biased
Returns:
a new Histogram
like image 868
danieln Avatar asked Apr 25 '13 11:04

danieln


1 Answers

When in doubt, look at the source:

    /**
     * Uses an exponentially decaying sample of 1028 elements, which offers a 99.9% confidence
     * level with a 5% margin of error assuming a normal distribution, and an alpha factor of
     * 0.015, which heavily biases the sample to the past 5 minutes of measurements.
     */
    BIASED {
        @Override
        public Sample newSample() {
            return new ExponentiallyDecayingSample(DEFAULT_SAMPLE_SIZE, DEFAULT_ALPHA);
        }
    };

A biased histogram is one that gives more weight to more recent measurements.

like image 61
Pace Avatar answered Nov 13 '22 05:11

Pace