Inconsistent datasource metrics configuration between MP Metrics and Micrometer
See original GitHub issueDescribe the bug
The datasource documentation says
By default, this metric collection mechanism gets turned on for all data sources if a metrics extension is present and metrics for the Agroal extension are enabled.
and the all config options documentation indicate that
quarkus.datasource.jdbc.enable-metrics
- If unspecified, collecting metrics will be enabled by default if a metrics extension is active.
However, when using the Micrometer extension quarkus-micrometer
it is necessary to explicitly set quarkus.datasource.jdbc.enable-metrics
to true
, in addition to quarkus.datasource.metrics.enabled=true
.
The reason seems to be that quarkus-micrometer
does not declare to have the io.quarkus.metrics
capability, the same way that the SmallRye metrics extension quarkus-smallrye-metrics
does.
Expected behavior
Using the Micrometer extension quarkus-micrometer
, Agroal datasource metrics should be collected after setting quarkus.datasource.metrics.enabled=true
, with quarkus.datasource.jdbc.enable-metrics
left unset.
Actual behavior
quarkus.datasource.jdbc.enable-metrics
needs to be explicitly set to true
.
How to Reproduce?
No response
Output of uname -a
or ver
No response
Output of java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
So the problem is that with SmallRye, metrics are enabled by default for all data sources, but disabled with Micrometer. The javadoc implies that they are enabled in both cases. If we’re not going to change the behavior, the javadoc should be changed, but I think it would make sense to unify this. If the global setting
quarkus.datasource.metrics.enabled
istrue
, and that needs to be set explicitly (!), why should we not enable them for all data sources by default? Most microservice apps only have one data source anyway.Yes, and as far as I could tell
mpMetricsPresent
was set based on theio.quarkus.metrics
capability.