aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Solano Gómez <daniel@solanogomez.org>2015-07-24 14:49:16 -0500
committerDaniel Solano Gómez <daniel@solanogomez.org>2015-07-24 14:53:52 -0500
commitdee441d00bfa796a7a1509ac828c6b1b7aabb389 (patch)
treee6f06099be74555b74207b3121fe6d980945c6ac
parentfee00711243a69ae007ae0f1bb6a72fe3de2c964 (diff)
downloadKamon-dee441d00bfa796a7a1509ac828c6b1b7aabb389.tar.gz
Kamon-dee441d00bfa796a7a1509ac828c6b1b7aabb389.tar.bz2
Kamon-dee441d00bfa796a7a1509ac828c6b1b7aabb389.zip
+ core: Allow creation of counters with units
Currently, the GenericEntityRecorder only allows two ways to create a new counter: 1. Using a simple name, resulting in a counter with an Unknown unit of measure 2. Using a CounterKey, but that is not really helpful since that class is private to Kamon This trivial patch adds a new counter method that accepts a unit of measure.
-rw-r--r--kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala3
1 files changed, 3 insertions, 0 deletions
diff --git a/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala b/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala
index 65dafa9a..15e20d1a 100644
--- a/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala
+++ b/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala
@@ -204,6 +204,9 @@ abstract class GenericEntityRecorder(instrumentFactory: InstrumentFactory) exten
protected def counter(name: String): Counter =
register(CounterKey(name, UnitOfMeasurement.Unknown), instrumentFactory.createCounter())
+ protected def counter(name: String, unitOfMeasurement: UnitOfMeasurement): Counter =
+ register(CounterKey(name, unitOfMeasurement), instrumentFactory.createCounter())
+
protected def counter(key: CounterKey): Counter =
register(key, instrumentFactory.createCounter())