Source:
MicrometerMetricsTracker(final String poolName, final PoolStats poolStats, final MeterRegistry meterRegistry) { this.connectionObtainTimer = Timer.builder(METRIC_NAME_WAIT) .description("Connection acquired time") .quantiles(WindowSketchQuantiles.quantiles(0.5, 0.95).create()) .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.connectionCreation = Timer.builder(METRIC_NAME_CONNECT) .description("Connection creation") .quantiles(WindowSketchQuantiles.quantiles(0.5, 0.95).create()) .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.connectionUsage = Timer.builder(METRIC_NAME_USAGE) .description("Connection usage time") .quantiles(WindowSketchQuantiles.quantiles(0.5, 0.95).create()) .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.connectionTimeoutCounter = Counter.builder(METRIC_NAME_TIMEOUT_RATE) .description("Connection timeout total count") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.totalConnectionGauge = Gauge.builder(METRIC_NAME_TOTAL_CONNECTIONS, poolStats, PoolStats::getTotalConnections) .description("Total connections") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.idleConnectionGauge = Gauge.builder(METRIC_NAME_IDLE_CONNECTIONS, poolStats, PoolStats::getIdleConnections) .description("Total connections") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.activeConnectionGauge = Gauge.builder(METRIC_NAME_ACTIVE_CONNECTIONS, poolStats, PoolStats::getActiveConnections) .description("Total connections") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.pendingConnectionGauge = Gauge.builder(METRIC_NAME_PENDING_CONNECTIONS, poolStats, PoolStats::getPendingThreads) .description("Total connections") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); }

Target:
MicrometerMetricsTracker(final String poolName, final PoolStats poolStats, final MeterRegistry meterRegistry) { this.connectionObtainTimer = Timer.builder(METRIC_NAME_WAIT) .description("Connection acquire time") .quantiles(WindowSketchQuantiles.quantiles(0.5, 0.95).create()) .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.connectionCreation = Timer.builder(METRIC_NAME_CONNECT) .description("Connection creation time") .quantiles(WindowSketchQuantiles.quantiles(0.5, 0.95).create()) .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.connectionUsage = Timer.builder(METRIC_NAME_USAGE) .description("Connection usage time") .quantiles(WindowSketchQuantiles.quantiles(0.5, 0.95).create()) .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.connectionTimeoutCounter = Counter.builder(METRIC_NAME_TIMEOUT_RATE) .description("Connection timeout total count") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.totalConnectionGauge = Gauge.builder(METRIC_NAME_TOTAL_CONNECTIONS, poolStats, PoolStats::getTotalConnections) .description("Total connections") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.idleConnectionGauge = Gauge.builder(METRIC_NAME_IDLE_CONNECTIONS, poolStats, PoolStats::getIdleConnections) .description("Idle connections") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.activeConnectionGauge = Gauge.builder(METRIC_NAME_ACTIVE_CONNECTIONS, poolStats, PoolStats::getActiveConnections) .description("Active connections") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); this.pendingConnectionGauge = Gauge.builder(METRIC_NAME_PENDING_CONNECTIONS, poolStats, PoolStats::getPendingThreads) .description("Pending threads") .tags(METRIC_CATEGORY, poolName) .register(meterRegistry); }