public void setMetricRegistry ( Object metricRegistry ) { if ( metricRegistry != null && safeIsAssignableFrom ( metricRegistry , "com.codahale.metrics.MetricRegistry" ) ) { setMetricsTrackerFactory ( new CodahaleMetricsTrackerFactory ( ( MetricRegistry ) metricRegistry ) ) ; } else if ( metricRegistry != null && safeIsAssignableFrom ( metricRegistry , "io.micrometer.core.instrument.MeterRegistry" ) ) { setMetricsTrackerFactory ( new MicrometerMetricsTrackerFactory ( ( MeterRegistry ) metricRegistry ) ) ; } else { setMetricsTrackerFactory ( null ) ; } }
Set a metrics registry to be used when registering metrics collectors . The HikariDataSource prevents this method from being called more than once .