Description
After the samples are purged couple of times, the calculated percentile values tend to decrease comparing to the expected values.
Consider the following simple example (sorry, idk if I can make it shorter):
int buckets = 100; Metrics metrics = new Metrics(new MetricConfig().eventWindow(buckets/2).samples(2)); Sensor sensor = metrics.sensor("test"); sensor.add(new Percentiles(4 * buckets, 100.0, Percentiles.BucketSizing.CONSTANT, new Percentile(metrics.metricName("test.p50", "grp1"), 50), new Percentile(metrics.metricName("test.p75", "grp1"), 75))); Metric p50 = metrics.metrics().get(metrics.metricName("test.p50", "grp1")); Metric p75 = metrics.metrics().get(metrics.metricName("test.p75", "grp1")); for (int i = 0; i < buckets; i++) sensor.record(i); System.out.printf("p50=%.3f p75=%.3f\n", p50.value(), p75.value()); for (int i = 0; i < buckets; i++) sensor.record(i); System.out.printf("p50=%.3f p75=%.3f\n", p50.value(), p75.value()); for (int i = 0; i < buckets; i++) sensor.record(i); System.out.printf("p50=%.3f p75=%.3f\n", p50.value(), p75.value());
The output from this is:
p50=50.000 p75=74.490 p50=24.490 p75=36.735 p50=15.306 p75=24.490
The expected output is, of course, with all three lines similar to the first one.
Attachments
Issue Links
- links to