aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/main/scala/kamon/metric/DynamicRange.scala
diff options
context:
space:
mode:
Diffstat (limited to 'kamon-core/src/main/scala/kamon/metric/DynamicRange.scala')
-rw-r--r--kamon-core/src/main/scala/kamon/metric/DynamicRange.scala33
1 files changed, 33 insertions, 0 deletions
diff --git a/kamon-core/src/main/scala/kamon/metric/DynamicRange.scala b/kamon-core/src/main/scala/kamon/metric/DynamicRange.scala
new file mode 100644
index 00000000..f26b1052
--- /dev/null
+++ b/kamon-core/src/main/scala/kamon/metric/DynamicRange.scala
@@ -0,0 +1,33 @@
+package kamon.metric
+
+import java.util.concurrent.TimeUnit
+
+case class DynamicRange(lowestDiscernibleValue: Long, highestTrackableValue: Long, significantValueDigits: Int) {
+ def upTo(highestTrackableValue: Long): DynamicRange =
+ copy(highestTrackableValue = highestTrackableValue)
+
+ def startingFrom(lowestDiscernibleValue: Long): DynamicRange =
+ copy(lowestDiscernibleValue = lowestDiscernibleValue)
+}
+
+object DynamicRange {
+ private val oneHourInNanoseconds = TimeUnit.HOURS.toNanos(1)
+
+ /**
+ * Provides a range from 0 to 3.6e+12 (one hour in nanoseconds) with a value precision of 1 significant digit (10%)
+ * across that range.
+ */
+ val Loose = DynamicRange(1L, oneHourInNanoseconds, 1)
+
+ /**
+ * Provides a range from 0 to 3.6e+12 (one hour in nanoseconds) with a value precision of 2 significant digit (1%)
+ * across that range.
+ */
+ val Default = DynamicRange(1L, oneHourInNanoseconds, 2)
+
+ /**
+ * Provides a range from 0 to 3.6e+12 (one hour in nanoseconds) with a value precision of 3 significant digit (0.1%)
+ * across that range.
+ */
+ val Fine = DynamicRange(1L, oneHourInNanoseconds, 3)
+}