From e7991fd2e38e36d6526db1e443bdce04bed39622 Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Mon, 20 Oct 2014 02:09:06 +0200 Subject: + core: provide sum and percentile functions in Histogram.Snapshot, closes #85 --- .../src/test/scala/kamon/metric/instrument/HistogramSpec.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'kamon-core/src/test/scala/kamon/metric/instrument') diff --git a/kamon-core/src/test/scala/kamon/metric/instrument/HistogramSpec.scala b/kamon-core/src/test/scala/kamon/metric/instrument/HistogramSpec.scala index cefdf0f4..c3060d4a 100644 --- a/kamon-core/src/test/scala/kamon/metric/instrument/HistogramSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/instrument/HistogramSpec.scala @@ -57,7 +57,7 @@ class HistogramSpec extends WordSpec with Matchers { } "produce a snapshot" which { - "supports min, max and numberOfMeasurements operations" in new HistogramFixture { + "supports min, max, percentile, sum and numberOfMeasurements operations" in new HistogramFixture { histogram.record(100) histogram.record(200, count = 200) histogram.record(300) @@ -67,7 +67,12 @@ class HistogramSpec extends WordSpec with Matchers { snapshot.min should equal(100L +- 1L) snapshot.max should equal(900L +- 9L) + snapshot.percentile(50.0D) should be(200) + snapshot.percentile(99.5D) should be(300) + snapshot.percentile(99.9D) should be(900) + snapshot.sum should be(41300) snapshot.numberOfMeasurements should be(203) + } "can be merged with another snapshot" in new MultipleHistogramFixture { -- cgit v1.2.3