@NonNullApi @NonNullFields public class HibernateQueryMetrics extends Object implements io.micrometer.core.instrument.binder.MeterBinder
MeterBinder
implementation that provides Hibernate query metrics. It exposes the
same statistics as would be exposed when calling Statistics.getQueryStatistics(String)
.
Note that only SELECT queries are recorded in QueryStatistics
.
Be aware of the potential for high cardinality of unique Hibernate queries executed by your
application when considering using this MeterBinder
.
Constructor and Description |
---|
HibernateQueryMetrics(SessionFactory sessionFactory,
String sessionFactoryName,
Iterable<io.micrometer.core.instrument.Tag> tags)
Create a
HibernateQueryMetrics . |
Modifier and Type | Method and Description |
---|---|
void |
bindTo(io.micrometer.core.instrument.MeterRegistry meterRegistry) |
static void |
monitor(io.micrometer.core.instrument.MeterRegistry registry,
SessionFactory sessionFactory,
String sessionFactoryName,
Iterable<io.micrometer.core.instrument.Tag> tags)
Create
HibernateQueryMetrics and bind to the specified meter registry. |
static void |
monitor(io.micrometer.core.instrument.MeterRegistry registry,
SessionFactory sessionFactory,
String sessionFactoryName,
String... tags)
Create
HibernateQueryMetrics and bind to the specified meter registry. |
public HibernateQueryMetrics(SessionFactory sessionFactory, String sessionFactoryName, Iterable<io.micrometer.core.instrument.Tag> tags)
HibernateQueryMetrics
.sessionFactory
- session factory to usesessionFactoryName
- session factory name as a tag valuetags
- additional tagspublic static void monitor(io.micrometer.core.instrument.MeterRegistry registry, SessionFactory sessionFactory, String sessionFactoryName, String... tags)
HibernateQueryMetrics
and bind to the specified meter registry.registry
- meter registry to usesessionFactory
- session factory to usesessionFactoryName
- session factory name as a tag valuetags
- additional tagspublic static void monitor(io.micrometer.core.instrument.MeterRegistry registry, SessionFactory sessionFactory, String sessionFactoryName, Iterable<io.micrometer.core.instrument.Tag> tags)
HibernateQueryMetrics
and bind to the specified meter registry.registry
- meter registry to usesessionFactory
- session factory to usesessionFactoryName
- session factory name as a tag valuetags
- additional tagspublic void bindTo(io.micrometer.core.instrument.MeterRegistry meterRegistry)
bindTo
in interface io.micrometer.core.instrument.binder.MeterBinder
Copyright © 2001-2021 Red Hat, Inc. All Rights Reserved.