jmxtrans / jmxtrans-agent

Java Agent based JMX metrics exporter.
MIT License
179 stars 110 forks source link

Add support for statsd gauge bucket in statsd output writer #44

Open NGough34 opened 9 years ago

NGough34 commented 9 years ago

Statsd allows for collection of stats in a few different data types: https://github.com/etsy/statsd/blob/master/docs/metric_types.md

I propose adding a bucketType field to the statsd output writer to allow configuring these different types of buckets - particularly the GAUGE type.

Is there any reason this hasn't been implemented? I can see in the code it is hardcoded to COUNT type. One issue I foresee is you inherently have the same bucketType for all queries, which will likely not be the case ie. you are collecting gauges and times but you've configured your output for a gauge.

I have implemented and semi-tested the GAUGE type so far.

cyrille-leclerc commented 9 years ago

Thanks @NGough34, you are right, I don't see any reason why we could not support GAUGE as well. Can you submit a PR?

mindkir commented 7 years ago

jmxtrans-agent-1.2.4.jar still return all mbean attributes as counters, eg: jmxtransagent.hostname.appname.env.OperatingSystem.ProcessCpuLoad:0.0045351473922902496|c

'java.lang:type=OperatingSystem' mbean 'ProcessCpuLoad' attribute is of Type 'double' and it should be metricType 'gauge'. Is there a way to configure this in existing jmxtrans-agent version?

mindkir commented 7 years ago

Found answer to this. Need to add "type" property along with mbean query, eg: <query objectName="java.lang:type=OperatingSystem" attributes="MaxFileDescriptorCount,OpenFileDescriptorCount,ProcessCpuLoad,SystemCpuLoad,SystemLoadAverage" type="gauge" resultAlias="#attribute#,mbean=%type%"/>

Might be good to add to documentation/configuration examples.

rtoma commented 7 years ago

Hi @mindkir, feel free to submit a pr for a doc fix. I am sure @cyrille-leclerc would appreciate that.

cyrille-leclerc commented 7 years ago

Thanks @mindkir and @rtoma. @mindkir can you please review https://github.com/jmxtrans/jmxtrans-agent/pull/92 ?