Search in sources :

Example 1 with Statistics

use of com.jolbox.bonecp.Statistics in project platformlayer by platformlayer.

the class BoneCpMetricsReporter method addMetrics.

@Override
public void addMetrics(MetricTreeObject tree) {
    BoneCP pool = getPool();
    if (pool == null) {
        // TODO: Should we handle this properly??
        return;
    }
    Statistics stats = pool.getStatistics();
    MetricTreeObject subtree = tree.getSubtree(key);
    subtree.addInt("hitCount", stats.getCacheHits());
    subtree.addInt("missCount", stats.getCacheMiss());
    subtree.addInt("connectionsRequested", stats.getConnectionsRequested());
    subtree.addInt("statementsCached", stats.getStatementsCached());
    subtree.addInt("statementsExecuted", stats.getStatementsExecuted());
    subtree.addInt("statementsPrepared", stats.getStatementsPrepared());
    subtree.addInt("cumulativeConnectionWaitTime", stats.getCumulativeConnectionWaitTime());
    subtree.addInt("cumulativeStatementExecutionTime", stats.getCumulativeStatementExecutionTime());
    subtree.addInt("cumulativeStatementPrepareTime", stats.getCumulativeStatementPrepareTime());
}
Also used : Statistics(com.jolbox.bonecp.Statistics) BoneCP(com.jolbox.bonecp.BoneCP)

Aggregations

BoneCP (com.jolbox.bonecp.BoneCP)1 Statistics (com.jolbox.bonecp.Statistics)1