Segence / kamon-jmx-collector

JMX metrics collector for Kamon.
Apache License 2.0
14 stars 6 forks source link

Hard to collect double valued percentages... #23

Open jtjeferreira opened 6 years ago

jtjeferreira commented 6 years ago

I am using kamon-jmx-collector to collect statistics from ehCache. However some statistics like CacheHitPercentage are stored in JMX as Double (i.e from 0.0 to 1.0). As far as I can understand, this library converts the Double to Long and I lose the precision of the percentage...

How do you think this can be improved? A user defined function to scale values?

robvadai commented 6 years ago

Hi there,

thanks for the feedback. This sounds like a very important feature request.

I think the code needs to be updated in 2 places:

I could look at these but probably in a bit of time. Well let me know if you want to give it a go otherwise I'll let you know when I made some progress with it.

jtjeferreira commented 6 years ago

Hi!

I think that those changes are not enough because kamon metrics only support Long:

https://github.com/kamon-io/Kamon/blob/794fbf02664ac8c31072d8b955d897901f1f22e0/kamon-core/src/main/scala/kamon/metric/Gauge.scala#L20-L28 https://github.com/kamon-io/Kamon/blob/794fbf02664ac8c31072d8b955d897901f1f22e0/kamon-core/src/main/scala/kamon/metric/Histogram.scala#L25-L31

so the only thing we can do is specify the MeasurementUnit. We can't escape the Double to Long conversion.

As soon as we find a path forward I can try to implement it...

robvadai commented 5 years ago

Hi there,

a user defined function sounds like a good idea.

Have you had a chance to think about the implementation?

I might be able to have a look at this soon.

jtjeferreira commented 5 years ago

Hi there,

Never got the chance to give this a try... Please go ahead...