Make result formats pluggable

Sergei Egorov bsideup at gmail.com
Wed Feb 19 15:09:46 UTC 2020


Hello!

I would like to work on making formats pluggable with SPI, akin profilers.

My motivation: I wanted my benchmarks to export results as Prometheus Text
Format [1], but the current set of formats does not include it and there is
no API to provide a custom one.

Implementation wise, it will be done the same way as in profilers (see
ProfilerFactory#getProfiler [2]):
1. Index built-in formats by key in a Map
2. lookup by format's type
3. If not available, try ServiceLoader

The addition of such SPI should not cause any incompatible change and will
be backward compatible.

Looking forward to hearing your thoughts!


- [1]
https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format
- [2]
https://github.com/openjdk/jmh/blob/7de311155d87beca066d1b071444d6ee44393b0c/jmh-core/src/main/java/org/openjdk/jmh/profile/ProfilerFactory.java#L58


More information about the jmh-dev mailing list