@Experimental public interface ConnectionPoolMetrics
id()
.Modifier and Type | Method and Description |
---|---|
long |
acquired()
A counter to record how many connections have been acquired from the pool since the pool is created.
|
int |
acquiring()
The number of connection acquisition requests that are currently in progress.
|
long |
closed()
A counter to record how many connections have been closed by this pool.
|
long |
created()
A counter to record how many connections have been successfully created with this pool since the pool is created.
|
int |
creating()
The amount of connections that are currently in the process of being created.
|
long |
failedToCreate()
A counter to record how many connections that have failed to be created.
|
String |
id()
An unique id that identifies this pool metrics.
|
int |
idle()
The amount of connections that are currently idle (buffered inside the pool).
|
int |
inUse()
The amount of connections that are currently in-use (borrowed out of the pool).
|
long |
timedOutToAcquire()
A counter to record how many times that we've failed to acquire a connection from the pool within configured maximum acquisition timeout
set by
Config.ConfigBuilder.withConnectionAcquisitionTimeout(long, TimeUnit) . |
long |
totalAcquisitionTime()
A counter to record the total acquisition time in milliseconds of all connection acquisition requests since the pool is created.
|
long |
totalConnectionTime()
A counter to record the total time in milliseconds spent to establishing new socket connections since the pool is created.
|
long |
totalInUseCount()
The total amount of connections that are borrowed outside the pool since the pool is created.
|
long |
totalInUseTime()
A counter to record the total time in milliseconds connections are borrowed out of the pool,
such as the time spent in user's application code to run cypher queries.
|
String id()
int inUse()
int idle()
int creating()
long created()
long failedToCreate()
long closed()
int acquiring()
long acquired()
long timedOutToAcquire()
Config.ConfigBuilder.withConnectionAcquisitionTimeout(long, TimeUnit)
.
This number increases every time when a connection is timed out when acquiring.long totalAcquisitionTime()
acquired()
for the total amount of connection acquired since the driver is created.
The average acquisition time can be calculated using the code below:
ConnectionPoolMetrics previous, current;
...
double average = computeAverage(current.totalAcquisitionTime(), previous.totalAcquisitionTime(), current.acquired(), previous.acquired());
previous = current;
...
private static double computeAverage(double currentSum, double previousSum, double currentCount, double previousCount)
{
return (currentSum-previousSum)/(currentCount-previousCount);
}
long totalConnectionTime()
created()
for the total amount of connections established since the pool is created.
The average connection time can be calculated using the code below:
ConnectionPoolMetrics previous, current;
...
double average = computeAverage(current.totalConnectionTime(), previous.totalConnectionTime(), current.created(), previous.created());
previous = current;
...
private static double computeAverage(double currentSum, double previousSum, double currentCount, double previousCount)
{
return (currentSum-previousSum)/(currentCount-previousCount);
}
long totalInUseTime()
totalInUseCount()
for the total amount of connections that are borrowed out of the pool.
The average in-use time can be calculated using the code below:
ConnectionPoolMetrics previous, current;
...
double average = computeAverage(current.totalInUseTime(), previous.totalInUseTime(), current.totalInUseCount(), previous.totalInUseCount());
previous = current;
...
private static double computeAverage(double currentSum, double previousSum, double currentCount, double previousCount)
{
return (currentSum-previousSum)/(currentCount-previousCount);
}
long totalInUseCount()