diff options
author | Diego Parra <diegolparra@gmail.com> | 2015-12-24 12:30:58 -0300 |
---|---|---|
committer | Diego Parra <diegolparra@gmail.com> | 2015-12-24 12:30:58 -0300 |
commit | 9899b33351ad769558b0bcd9af4533b070c91162 (patch) | |
tree | 735de28155e9ec9fce26b2f0ed1754a38fb81ade /kamon-core/src/main/scala/kamon/metric/instrument/Counter.scala | |
parent | 961c6080fbf3cb1662121992a6ba65d7ca999a1e (diff) | |
parent | 4a918ce6570129d3d4fd2d3e98d43f8078bb2d99 (diff) | |
download | Kamon-9899b33351ad769558b0bcd9af4533b070c91162.tar.gz Kamon-9899b33351ad769558b0bcd9af4533b070c91162.tar.bz2 Kamon-9899b33351ad769558b0bcd9af4533b070c91162.zip |
Merge pull request #294 from jozic/scale
Scale
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 | 5 |
1 files changed, 5 insertions, 0 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 index c1b69cbe..349a12bd 100644 --- a/kamon-core/src/main/scala/kamon/metric/instrument/Counter.scala +++ b/kamon-core/src/main/scala/kamon/metric/instrument/Counter.scala @@ -33,6 +33,7 @@ object Counter { trait Snapshot extends InstrumentSnapshot { def count: Long def merge(that: InstrumentSnapshot, context: CollectionContext): Counter.Snapshot + def scale(from: UnitOfMeasurement, to: UnitOfMeasurement): Counter.Snapshot } } @@ -57,4 +58,8 @@ case class CounterSnapshot(count: Long) extends Counter.Snapshot { case CounterSnapshot(thatCount) ⇒ CounterSnapshot(count + thatCount) case other ⇒ sys.error(s"Cannot merge a CounterSnapshot with the incompatible [${other.getClass.getName}] type.") } + + override def scale(from: UnitOfMeasurement, to: UnitOfMeasurement): Counter.Snapshot = + CounterSnapshot(from.tryScale(to)(count).toLong) + }
\ No newline at end of file |