Feature Request: Support `createdTimestampMillis` in `PrometheusProtobufWriterImpl`
Background:
We're using Spring Boot 3.5.x with Micrometer 1.15.2, and would like to leverage the createdTimestamp feature introduced behind a feature flag on the Prometheus server.
On Prometheus server side this feature is only available if the Prometheus Protobuf Protocol is used.
In the Prometheus Java client, we noticed that the PrometheusProtobufWriterImpl currently only maps scrapeTimestampMillis from the DataPointSnapshot, but not the available createdTimestampMillis.
What we did:
We tested adding support for createdTimestampMillis in a fork of the latest release and confirmed that our counter metrics are now exposed with an initialized value of 0 as expected. This also builds on recent support added to Micrometer for this field (micrometer-metrics/micrometer#2625).
Proposal:
We propose updating PrometheusProtobufWriterImpl to also map and include createdTimestampMillis, similar to how scrapeTimestampMillis is currently handled. This would improve compatibility with Prometheus’ feature flag and help downstream libraries like Micrometer to fully support this newer functionality.
Would you be open to a PR for this? We're happy to contribute the necessary change if desired.
Thanks for your great work on this library!
Yes that sounds great!
We got a question about the desired implementation. The necessary adjustment we want to be available is: https://github.com/prometheus/client_java/commit/6043873ab07a5550f2d3d7cf5266d060ff9bb3d1.
Looking at the test changes needed in several places, like the (Protobuf)ExpositionFormatsTest, the question is whether these changes should or must be configurable like in the ExpositionFormats? Should there be a feature flag to enable enriching the createdTimestamp?
Should there be a feature flag to enable enriching the createdTimestamp?
no, for protobuf, it can always be included
Sorry for the delay. PR is opened @zeitlinger