Add auto-configuration for Hibernate metrics
All Hibernate entityManagerFactories are automatically instrumented and their statistics are included into Micrometer using its HibernateMetrics binder. Closes gh-12550
This commit is contained in:
committed by
Stephane Nicoll
parent
3cb2246e7a
commit
b6b92ba937
@@ -1774,6 +1774,25 @@ Auto-configuration will enable the instrumentation of all available RabbitMQ con
|
||||
factories with a metric named `rabbitmq`.
|
||||
|
||||
|
||||
[[production-ready-metrics-hibernate]]
|
||||
==== Hibernate Metrics
|
||||
Auto-configuration enables the instrumentation of all available Hibernate
|
||||
`EntityManagerFactory` objects that have statistics enabled with a metric named
|
||||
`hibernate`.
|
||||
|
||||
Metrics are also tagged by the name of the `EntityManagerFactory` that is derived from
|
||||
the bean name.
|
||||
|
||||
To enable statistics on Hibernate `EntityManagerFactory` instances, JPA property `hibernate.generate_statistics` must be set to `true`. For example, on the default
|
||||
`EntityManagerFactory`, you need to set the following property:
|
||||
|
||||
.application.properties
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.jpa.properties.hibernate.generate_statistics=true
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[production-ready-metrics-custom]]
|
||||
=== Registering custom metrics
|
||||
|
||||
Reference in New Issue
Block a user