I have used the HikariPoolMXBean bean to get some of the metrics and it seems all fine.
Total, active, idle & pending connections
But I couldn't find any way to get the following metrics from the MBean:
- Average wait time to get a connection
- Max wait time to get a connection
- Average in-use time of a connection
- Max in-use time of a connection
- Max number of connections in simultaneous use.
I set up a metric registry and obtained the following timer & histogram. But I am not sure if what I am doing is correct.
Timer timerWT = timers.get(pool.getPoolName() + ".pool.Wait");
System.out.println(" Average wait time = "+ timerWT.getSnapshot().getMean());
System.out.println(" Peak wait time = "+ timerWT.getSnapshot().getMax());
Histogram histogramPC = histograms.get(pool.getPoolName() + ".pool.Usage");
System.out.println(" Peak number of connections = "+ histogramPC.getSnapshot().getMax());
And I couldn't even figure out how to get the average & max in-use time.
~Debajyoti