prometheus / client_java

Prometheus instrumentation library for JVM applications

Home Page:http://prometheus.github.io/client_java/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Integrating Native Histograms with Spring 2.7.x and Prometheus client_java 1.3.1: Challenges in Writing Native Histograms to Response Object

kiransunkari opened this issue · comments

We are exploring native histograms in Prometheus and we are using Spring 2.7.x. Our existing monitoring dashboards rely on the default metrics exposed by Spring. Therefore, we need to include both the default Spring metrics exposed by the spring-micrometer and custom native histograms from the Prometheus client_java library because Micrometer in Spring does not yet support native histograms.

I have created native histograms and tried to expose them at a new endpoint, /metrics. The challenge is that I need to write the native histogram data to the response object in text format.

For classic histograms, I used the TextFormat from the Prometheus simple client library. But in the latest 1.3.1 version of the client_java library, metrics are coming as MetricSnapshots. I need an API to convert MetricSnapshots which contains native histograms to text format.

I explored the Prometheus-metrics-exposition-format library to convert MetricSnapshots to text format. However, this library does not support exporting native histograms to text format. Only the PrometheusProtoBuffFormatter considers native histograms while exporting to the protobuff format.

P.S.: I know native histograms are still an experimental feature, but I'm asking this question here in case someone has already achieved this.