aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2017-06-30 11:57:08 +0200
committerIvan Topolnjak <ivantopo@gmail.com>2017-06-30 11:57:08 +0200
commit71a9f6519263f9d237b4ad189243f602d484cc92 (patch)
treefdd7526e335c2f56f618a4e0d8d5a2ca1ae16cca
parent0759505be988ad2b8c9d14ec322681e48033a687 (diff)
downloadKamon-71a9f6519263f9d237b4ad189243f602d484cc92.tar.gz
Kamon-71a9f6519263f9d237b4ad189243f602d484cc92.tar.bz2
Kamon-71a9f6519263f9d237b4ad189243f602d484cc92.zip
extract ZigZagCountsDistribution into the SnapshotCreation companion
-rw-r--r--kamon-core/src/main/scala/kamon/metric/Histogram.scala20
1 files changed, 10 insertions, 10 deletions
diff --git a/kamon-core/src/main/scala/kamon/metric/Histogram.scala b/kamon-core/src/main/scala/kamon/metric/Histogram.scala
index 94172ff5..65027fcf 100644
--- a/kamon-core/src/main/scala/kamon/metric/Histogram.scala
+++ b/kamon-core/src/main/scala/kamon/metric/Histogram.scala
@@ -18,6 +18,7 @@ package metric
import java.nio.ByteBuffer
+import kamon.metric.SnapshotCreation.ZigZagCountsDistribution
import kamon.util.MeasurementUnit
import org.HdrHistogram.{AtomicHistogramExtension, HdrHistogramOps, SimpleHistogramExtension, ZigZag}
import org.slf4j.LoggerFactory
@@ -72,7 +73,7 @@ private[kamon] class HdrHistogram(name: String, tags: Map[String, String], val u
}
-trait SnapshotCreation {
+private[kamon] trait SnapshotCreation {
self: HdrHistogramOps with Histogram =>
private[kamon] def snapshot(resetState: Boolean, name: String, tags: Map[String, String]): MetricDistribution = {
@@ -122,8 +123,15 @@ trait SnapshotCreation {
MetricDistribution(name, tags, unit, dynamicRange, distribution)
}
+}
- private class ZigZagCountsDistribution(val count: Long, minIndex: Int, maxIndex: Int, zigZagCounts: ByteBuffer,
+private[kamon] object SnapshotCreation {
+ // TODO: maybe make the buffer size configurable or make it auto-expanding.
+ private val tempSnapshotBuffer = new ThreadLocal[ByteBuffer] {
+ override def initialValue(): ByteBuffer = ByteBuffer.allocate(33792)
+ }
+
+ class ZigZagCountsDistribution(val count: Long, minIndex: Int, maxIndex: Int, val zigZagCounts: ByteBuffer,
unitMagnitude: Int, subBucketHalfCount: Int, subBucketHalfCountMagnitude: Int) extends Distribution {
val min: Long = if(count == 0) 0 else bucketValueAtIndex(minIndex)
@@ -221,14 +229,6 @@ trait SnapshotCreation {
case class DefaultPercentile(quantile: Double, value: Long, countUnderQuantile: Long) extends Percentile
case class MutablePercentile(var quantile: Double, var value: Long, var countUnderQuantile: Long) extends Percentile
-
-}
-
-object SnapshotCreation {
- // TODO: maybe make the buffer size configurable or make it auto-expanding.
- private val tempSnapshotBuffer = new ThreadLocal[ByteBuffer] {
- override def initialValue(): ByteBuffer = ByteBuffer.allocate(33792)
- }
}
object AtomicHdrHistogram {