-
Notifications
You must be signed in to change notification settings - Fork 395
Micrometer Prometheus client v1.x breaking changes #2340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brunobat
wants to merge
1
commit into
quarkusio:main
Choose a base branch
from
brunobat:develop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| --- | ||
| layout: post | ||
| title: 'Quarkus Micrometer using Prometheus client v1' | ||
| date: 2025-11-07 | ||
| tags: micrometer prometheus | ||
| synopsis: Micrometer has moved to use the Prometheus client v1. This post explains the migration path and required changes for applications. | ||
| author: brunobat | ||
| --- | ||
|
|
||
| == Quarkus Micrometer using Prometheus client v1 | ||
|
|
||
| Micrometer adopted Prometheus Client v1.x starting with version 1.13. However, Quarkus still uses Prometheus Client v0.x by default through the `quarkus-micrometer-registry-prometheus` extension which has been using the legacy `io.prometheus:simpleclient`. | ||
| This is now considered *deprecated* and will not be part of the future Quarkus 4.x version (still no timeline). | ||
|
|
||
| In parallel, we have introduced a new extension in Quarkiverse: https://docs.quarkiverse.io/quarkus-micrometer-registry/dev/micrometer-registry-prometheus-v1.html[`quarkus-micrometer-registry-prometheus-v1`], which integrates the new v1.x client. | ||
|
|
||
|
|
||
| ```xml | ||
| <dependency> | ||
| <groupId>io.quarkiverse.micrometer.registry</groupId> | ||
| <artifactId>quarkus-micrometer-registry-prometheus-v1</artifactId> | ||
| </dependency> | ||
| ``` | ||
|
|
||
| Since the new client introduces *breaking changes*, we’ve prepared a migration plan designed to reduce the impact on existing users. | ||
|
|
||
| [INFO] | ||
| ==== | ||
| Some of the changes affect the names of some metrics. This requires queries and dashboards to be updated in order to continue working. | ||
| Users should evaluate the impacts for their projects before moving to the new `quarkus-micrometer-registry-prometheus-v1` extension. | ||
| ==== | ||
|
|
||
| [WARNING] | ||
| ==== | ||
| The old and the new extension should not be used at the same time as the both require the `/q/metrics` endpoint. | ||
| ==== | ||
|
|
||
| === Migrating to the new extension | ||
|
|
||
| 1. Users can keep current extension as is until Quarkus 4.0 allowing them to migrate at a time of their choice. | ||
| 2. We are introducing the new extension https://docs.quarkiverse.io/quarkus-micrometer-registry/dev/micrometer-registry-prometheus-v1.html[`quarkus-micrometer-registry-prometheus-v1`] and users can start migrating their projects to it right now. | ||
| 3. For Quarkus 4.0 we will introduce the following changes: | ||
| ** The deprecated `quarkus-micrometer-registry-prometheus` extension will be moved from Quarkus core repo to Quarkiverse, allowing an additional migration period. | ||
| ** The new https://docs.quarkiverse.io/quarkus-micrometer-registry/dev/micrometer-registry-prometheus-v1.html[`quarkus-micrometer-registry-prometheus-v1`] extension will be moved from Quarkiverse to Quarkus core repo, making it the default registry. | ||
|
|
||
| === Breaking changes | ||
|
|
||
brunobat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| As mentioned above, the new extension comes with a set of breaking changes. | ||
|
|
||
| ==== Prometheus client v1 | ||
|
|
||
| The `quarkus-micrometer-registry-prometheus-v1` extension will be using the Prometheus Client v1.x and includes *breaking changes* expressed in detail on the https://github.com/micrometer-metrics/micrometer/wiki/1.13-Migration-Guide[Micrometer 1.13 Migration Guide], featuring package, API and semantic convention changes. | ||
|
|
||
| These are the main points to consider when migrating to the new Quarkus extension: | ||
|
|
||
| * Counters now use Longs instead of Doubles. | ||
| ** Before: `"registry=\"prometheus\",status=\"200\",uri=\"/example/prime/{number}\"} 2.0` | ||
| ** Now: `"registry=\"prometheus\",status=\"200\",uri=\"/example/prime/{number}\"} 2` | ||
| * `io.micrometer.prometheusmetrics.PrometheusMeterRegistry` must be used instead of the old `io.micrometer.prometheus.PrometheusMeterRegistry`. | ||
| * `io.prometheus.metrics.tracer.common.SpanContext` must be used instead of the old `io.prometheus.client.exemplars.ExemplarSampler` | ||
| * The new Prometheus client uses some reserved words that must not be used to name metrics, therefore some metrics were renamed. Some examples of reserved words and renamed metrics: | ||
| ** `info`. Before: `jvm_info_total`. Now: `jvm_total` | ||
brunobat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ** `duration`. Before: `http_server_requests_duration_seconds`. Now: `http_server_requests_seconds` | ||
| * Some metrics would display Tags ending in a comma (`,`). This tailing comma has now been removed. Example: `hibernate_flushes_total{entityManagerFactory=\"<default>\",env=\"test\",env2=\"test\",registry=\"prometheus\",} 1.0` | ||
| * It is no longer possible to create a metric generating Service Level Objectives and Percentiles at the same time. | ||
|
|
||
| ==== Change when registering metrics: | ||
|
|
||
| Metrics must be registered always with the same tags. Micrometer will now send a warning if we register the same metric more than once with different Tag names. | ||
|
|
||
| ==== Implementation changes | ||
|
|
||
| Quarkus automatic instrumentation will generate metrics reflecting these changes. If your application defines custom metrics, be sure to update their creation, associated tests, and any dashboard queries to align with the guidelines above. | ||
|
|
||
brunobat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| === About metrics in Quarkus | ||
|
|
||
| The https://quarkus.io/guides/telemetry-micrometer[Micrometer extension] is the recommended approach to generate metrics in Quarkus and this a rare occasions were breaking changes are being introduced. | ||
|
|
||
| Micrometer has become the default metrics framework in Quarkus due to its stability, maturity, and widespread adoption on the Java ecosystem — not https://quarkus.io/guides/opentelemetry-metrics[OpenTelemetry Metrics]. | ||
|
|
||
| Micrometer support in Quarkus is built on top af a main extension `quarkus-micrometer`, then specific registries extensions include it as a dependency and implement a registry sending out the telemetry. The Prometheus registry (`quarkus-micrometer-registry-prometheus`) is the default and most commonly used, and it is the focus of this announcement. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Of not af :-) |
||
|
|
||
| However, there are alternative ways to export metrics using Micrometer: | ||
|
|
||
| * Through the https://github.com/quarkiverse/quarkus-micrometer-registry/[Quarkiverse Micrometer registries] | ||
| * Via OpenTelemetry, using a bridge provided by the https://quarkus.io/guides/telemetry-micrometer-to-opentelemetry[Micrometer and OpenTelemetry] extension. This setup allows Micrometer metrics to be sent as OpenTelemetry metrics, offering a unified output via the https://opentelemetry.io/docs/specs/otlp/[OpenTelemetry OTLP protocol]. | ||
|
|
||
| For more details on Observability in Quarkus please visit https://quarkus.io/guides/observability[this guide]. | ||
brunobat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| === Conclusion | ||
|
|
||
| While the existing Prometheus registry remains available for the Quarkus 3.x lifecycle, it is now deprecated, and users are encouraged to begin migrating to the new extension because the old client extension will be removed on Quarkus 4.0 (no timeline at this moment). | ||
|
|
||
| This change introduces a number of breaking updates aligned with Micrometer 1.13 and Prometheus Client v1.x, affecting metric types, naming conventions, and APIs. | ||
|
|
||
| To support users, a migration plan has been outlined to provide flexibility and minimize disruption. | ||
|
|
||
| The prometheus client is not the only option to send out telemetry, there are alternative options such as the Quarkiverse registries or our OpenTelemetry bridge. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To migrate to the new extension, follow these steps: