From 6ecc3343b2f79308d0edd02ef02ed818c30ec581 Mon Sep 17 00:00:00 2001 From: Daniel Solano Gómez Date: Fri, 24 Jul 2015 14:49:16 -0500 Subject: + 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. --- kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala | 3 +++ 1 file changed, 3 insertions(+) (limited to 'kamon-core/src/main/scala/kamon/metric') 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()) -- cgit v1.2.3