jmxtrans / jmxtrans-agent

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

Support for custom properties per query (InfluxDB) #107

Open leolimajr opened 7 years ago

leolimajr commented 7 years ago

InfluxDB has a concept of multiple fields and tags per measurement for storing time series metrics in an optimized way.

The current implementation of InfluxDbOutputWriter is not taking advantage of that, it is only possible to create one field value per metric with fixed tags defined at the outputWriter declaration.

But it is not a limitation imposed by the outputWriter but at the query API.

I'd like to propose a more flexible but generic way to have more properties per query, so we could expand the implementation options in the outputWriters so not only InfluxDbOutputWriter would benefit from it. The ideia would be something like adding a propert list inside query definition as follows:

<query objectName="sample:instance=*,name=rollingCount,type=business_counters" attribute="value" resultAlias="business_counters">
 <properties>
   <property name="host" type="tag" value="${HOSTNAME}"/>
   <property name="%instance%" type="field" value="%attribute%">
 </properties>
</query>

Does it make sense to you guys? I'd like to hear your thoughts.

gehel commented 7 years ago

Sounds like a great idea!

Igor-Ivaniuk commented 7 years ago

To implement these enhancements, we would need to modify jmxtrans-core as well as influxdb output writer. Does it make sense to move the discussion of the proposed changes to the main jmxtrans issues list? There are more similar issues there

cyrille-leclerc commented 7 years ago

@Igor-Ivaniuk We unfortunately don't share code between jmxtrans, jmxtrans-agent and embedded-jmxtrans (the pros & cons to mutualize some pieces of code are not easy), jmxtrans-agent does not use jmxtrans-core.

That said, it would be valuable to initiate a thread on the mailing list to see how we can mutualize the efforts :-)

kerlandsson commented 7 years ago

It would be awesome if we could add support for multiple fields. I haven't been working with this stuff for a long time now so I can't give the exact proposal an honest evaluation.