Reinstate support for Hibernate Metrics

Closes gh-31675
This commit is contained in:
Andy Wilkinson
2022-07-11 20:47:13 +01:00
parent b10c57551c
commit 9b113272d1
7 changed files with 353 additions and 2 deletions

View File

@@ -906,6 +906,25 @@ Each metric is tagged by the name of the pool (you can control it with `spring.d
[[actuator.metrics.supported.hibernate]]
==== Hibernate Metrics
If `org.hibernate.orm:hibernate-micrometer` is on the classpath, all available Hibernate `EntityManagerFactory` instances that have statistics enabled are instrumented with a metric named `hibernate`.
Metrics are also tagged by the name of the `EntityManagerFactory`, which is derived from the bean name.
To enable statistics, the standard JPA property `hibernate.generate_statistics` must be set to `true`.
You can enable that on the auto-configured `EntityManagerFactory`:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
jpa:
properties:
"[hibernate.generate_statistics]": true
----
[[actuator.metrics.supported.spring-data-repository]]
==== Spring Data Repository Metrics
Auto-configuration enables the instrumentation of all Spring Data `Repository` method invocations.