diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2017-06-08 15:35:42 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2017-06-08 15:35:42 +0200 |
commit | b94ca0cbb931799ccd2ad2d245660c4d48032c83 (patch) | |
tree | d87dc8ccfc0395cdc331b2cfb69e799a3f4d0974 /kamon-core/src/main/scala/kamon/metric/Accumulator.scala | |
parent | 7817621ad1a62db1bd7b7b60ed823b4da169a34a (diff) | |
download | Kamon-b94ca0cbb931799ccd2ad2d245660c4d48032c83.tar.gz Kamon-b94ca0cbb931799ccd2ad2d245660c4d48032c83.tar.bz2 Kamon-b94ca0cbb931799ccd2ad2d245660c4d48032c83.zip |
get a basic threading model for the span reporters
Diffstat (limited to 'kamon-core/src/main/scala/kamon/metric/Accumulator.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/metric/Accumulator.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kamon-core/src/main/scala/kamon/metric/Accumulator.scala b/kamon-core/src/main/scala/kamon/metric/Accumulator.scala new file mode 100644 index 00000000..b87f5530 --- /dev/null +++ b/kamon-core/src/main/scala/kamon/metric/Accumulator.scala @@ -0,0 +1,17 @@ +package kamon.metric + +import kamon.util.MeasurementUnit + + +class DistributionAccumulator(dynamicRange: DynamicRange) { + private val accumulatorHistogram = new HdrHistogram("metric-distribution-accumulator", + tags = Map.empty, measurementUnit = MeasurementUnit.none, dynamicRange) + + + def add(distribution: Distribution): Unit = { + distribution.bucketsIterator.foreach(b => accumulatorHistogram.record(b.value, b.frequency)) + } + + def result(): Distribution = + accumulatorHistogram.snapshot().distribution +} |