logzio / jmx2graphite

JMX to Graphite every x seconds in one command line (Docker based) (also come in Java Agent flavour)
MIT License
77 stars 23 forks source link

Fix metric name sanitization #129

Closed luneo7 closed 2 years ago

luneo7 commented 2 years ago

Doing a URL encode to the metric name doesn't actually fix the issue with special characters, we actually need to handle Graphite grammar and also normalize the name in the NFKD form. This is what Micrometer does for instance. We also need to make sure that the metric value is in the format that graphite will always understand, and that's why I used the same formatting that Dropwizard Graphite Reporter uses, so it formats float and double in the same way that graphite is expecting them.

We needed that fix to be properly able to export C3P0 and HikariCP metrics to our Graphite system, without those changes the metrics sent to Graphite made us get the following error:

image

asafm commented 2 years ago

@luneo7 Thank you for your contribution. Since I left Logz.io I got left without write access, so @doron-logzio is helping me, and then I'll merge and release a new version.

github-actions[bot] commented 2 years ago

Unit Test Results

3 tests   3 :heavy_check_mark:  10s :stopwatch: 2 suites  0 :zzz: 2 files    0 :x:

Results for commit d964f461.