[Java] HikariCP - definition of Custom metrics

Hi;

I’ve started using the HikariCP agent extension.

The good news is that I’m getting some data out of my app in that I can see Custom metrics for Hikari where none existed before (yay!).

The bad news is that the metrics make no sense to me (boo!).

  1. There are two metrics Busy Count and Idle Count for my pool. Are there others available as well?
  2. What is the definition for Busy and Idle counts and what is their unit of measure? I ask because the query for the Busy and Idle count says “average(newrelic.timeslice.value) * 1000”. This gives me values like 10k - I don’t have 10k db connections so what does this mean?

Thanks,

Brian.

@bdueck I took a look at the instrumentation for HikariCP and it looks like Busy Count and Idle Count are the only two metrics captured.

It looks like it simply captures the two metrics from HikariPool#getActiveConnections and HikariPool#getIdleConnections in PooledDataSourceSampler#run:

https://www.javadoc.io/doc/com.zaxxer/HikariCP/2.4.1/com/zaxxer/hikari/pool/HikariPool.html

@Override
public void run() {
    HikariPool hikariPool = hikariPoolRef.get();
    if (null == hikariPool) {
        return;
    }
           
    MetricAggregator metricAggregator = NewRelic.getAgent().getMetricAggregator();
    
    metricAggregator.recordMetric(baseName + "Busy Count[connections]", hikariPool.getActiveConnections());
    metricAggregator.recordMetric(baseName + "Idle Count[connections]", hikariPool.getIdleConnections());
}

I’m not sure what’s up with the query (average(newrelic.timeslice.value) * 1000) as I work on the agent/data collection side of things. Where exactly do you see this?

1 Like

Did you ever got response on this ? - I am seeing same issue in newrelic

Hi @vamsikrishna.vishnu1

I wanted to take a closer look into the previously question brought up:

  1. What is the definition for Busy and Idle counts and what is their unit of measure? I ask because the query for the Busy and Idle count says “average(newrelic.timeslice.value) * 1000”. This gives me values like 10k - I don’t have 10k db connections so what does this mean?

Could share a link to your application in New Relic One? Only those on your account and New Relic Admins will be able to view your application. To create a permalink within the New Relic, you can use the ‘Share’ button in the top right corner under your user profile or share the full URL from any page.

  1. What is the definition for Busy and Idle counts and what is their unit of measure? I ask because the query for the Busy and Idle count says “average(newrelic.timeslice.value) * 1000”. This gives me values like 10k - I don’t have 10k db connections so what does this mean?

Anybody got an answer for this question?

Hello @Ganesan_Karthikeyan - Could share a link to your application in New Relic One? Only those on your account and New Relic Admins will be able to view your application. To create a permalink within the New Relic, you can use the ‘Share’ button in the top right corner under your user profile or share the full URL from any page.