public void setMetricRegistry ( Object metricRegistry ) { if ( metricsTrackerFactory != null ) { throw new IllegalStateException ( "cannot use setMetricRegistry() and setMetricsTrackerFactory() together" ) ; } if ( metricRegistry != null ) { metricRegistry = getObjectOrPerformJndiLookup ( metricRegistry ) ; if ( ! safeIsAssignableFrom ( metricRegistry , "com.codahale.metrics.MetricRegistry" ) && ! ( safeIsAssignableFrom ( metricRegistry , "io.micrometer.core.instrument.MeterRegistry" ) ) ) { throw new IllegalArgumentException ( "Class must be instance of com.codahale.metrics.MetricRegistry or io.micrometer.core.instrument.MeterRegistry" ) ; } } this . metricRegistry = metricRegistry ; }
Set a MetricRegistry instance to use for registration of metrics used by HikariCP .