diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2017-06-06 14:15:15 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2017-06-06 14:15:15 +0200 |
commit | c52f8eaca0d1ccc4c992cba039e35e099b5b478b (patch) | |
tree | f9e78e2f929627e7547bef39fdf6cbcd544cb8d8 /kamon-core/src/main/scala/kamon/metric/instrument/Counter.scala | |
parent | 1f5d9876dedb715ae1c31203ea4f15ebf031612c (diff) | |
download | Kamon-c52f8eaca0d1ccc4c992cba039e35e099b5b478b.tar.gz Kamon-c52f8eaca0d1ccc4c992cba039e35e099b5b478b.tar.bz2 Kamon-c52f8eaca0d1ccc4c992cba039e35e099b5b478b.zip |
make it compile for Scala 2.11 and 2.12
Diffstat (limited to 'kamon-core/src/main/scala/kamon/metric/instrument/Counter.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/metric/instrument/Counter.scala | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/kamon-core/src/main/scala/kamon/metric/instrument/Counter.scala b/kamon-core/src/main/scala/kamon/metric/instrument/Counter.scala deleted file mode 100644 index f18e771c..00000000 --- a/kamon-core/src/main/scala/kamon/metric/instrument/Counter.scala +++ /dev/null @@ -1,34 +0,0 @@ -package kamon -package metric -package instrument - -import java.util.concurrent.atomic.LongAdder - -import com.typesafe.scalalogging.StrictLogging -import kamon.util.MeasurementUnit - -trait Counter { - def measurementUnit: MeasurementUnit - - def increment(): Unit - def increment(times: Long): Unit -} - -class LongAdderCounter(name: String, tags: Map[String, String], val measurementUnit: MeasurementUnit) - extends SnapshotableCounter with StrictLogging { - - private val adder = new LongAdder() - - def increment(): Unit = - adder.increment() - - def increment(times: Long): Unit = { - if (times >= 0) - adder.add(times) - else - logger.warn(s"Ignored attempt to decrement counter [$name]") - } - - def snapshot(): SingleValueSnapshot = - SingleValueSnapshot(name, tags, measurementUnit, adder.sumThenReset()) -} |