Skip to content

Add support for parsing/transforming string metrics #372

@HontoNoRoger

Description

@HontoNoRoger

I'm monitoring Solr via JMX and want to get the metric attribute total_size of the fieldCache solr:dom1=core,dom2=myawesomecore,category=CACHE,scope=core,name=fieldCache into Datadog.

Unfortunately this metric is pushed as java.lang.String in the form of 4.5 MB.
Currently, JMXFetch is unable to transform that in a numeric value, which I could use to set the unit to "MB" if it would at least be able to get the "4.5" part.

According to the tests, JMXFetch can be set to take predefined values for String fields, such as:

values:
  ShouldBe0: 0
  ShouldBe5: 5

but that is not sufficient in this case unfortunately as the values the metric can take are possibly limitless.

It would be great if one could specify arbitrary parsings/transformations to the fetcher before sending the end result to Datadog.
One option might be to transform "4.5 MB" to 4718592 (a Byte value based on IEC Mebibytes), 4500000 (a Byte value based on SI units) or only 4.5 which one can use in conjunction with choosing the correct unit.
The last option however is dangerous, as the metric might push something "1.2 GB" or "553 KB" in theory.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions