jmxtrans / jmxtrans-agent

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

Support for statsd metric tagging #81

Open tcrossland opened 8 years ago

tcrossland commented 8 years ago

It would be useful to be able to use statsd tags in metrics (see the Metric Tagging section here), for example:

<query objectName="..." attribute="..." resultAlias="metric-name#tag=value"/>

Currently this will be rejected by jmxtrans-agent's expression engine:

Invalid expression 'metric-name#tag=value', no ending '#' after beginning '#' at position ...
cyrille-leclerc commented 8 years ago

Thanks @tcrossland,

# is a reserved character used by the "expression language engine". We would have to extend the "expression language engine" to support an escape character '\' so we could define \#

It would look like

<query objectName="..." attribute="..." resultAlias="metric-name\#tag=value"/>

It should not be a huge amount of work.

https://github.com/jmxtrans/jmxtrans-agent/blob/efa75a3bee4c285e8d4f44f974131d653bfeb8b8/src/main/java/org/jmxtrans/agent/ExpressionLanguageEngineImpl.java#L90-L90

tcrossland commented 8 years ago

@cyrille-leclerc thanks, that seems like a reasonable approach. Let me know if I can help.

jakobant commented 6 years ago

Updated to support statsd tags, both for Sysdig and DataDog

https://github.com/jmxtrans/jmxtrans-agent/pull/118

jrpilat commented 6 years ago

@jakobant Are you sure that's the same functionality? This issue describes being able to have different tags on different queries which share the same StatsDOutputWriter. Maybe I misunderstood your comment.