/** * Retrieves the set of statistics maintained for the read pool. * * @return The set of statistics maintained for the read pool. */ public LDAPConnectionPoolStatistics getReadPoolStatistics() { return readPool.getConnectionPoolStatistics(); }
/** * Retrieves the set of statistics maintained for the write pool. * * @return The set of statistics maintained for the write pool. */ public LDAPConnectionPoolStatistics getWritePoolStatistics() { return writePool.getConnectionPoolStatistics(); }
/** * Creates a new LDAP connection metrics. * * @param pool The LDAP connection pool. Must not be {@code null}. * @param prefix The metrics name prefix. Must not be {@code null}. */ public LDAPConnectionPoolMetrics(final LDAPConnectionPool pool, final String prefix) { metricMap.put(prefix + ".maxAvailableConnections", (Gauge<Integer>) () -> pool.getConnectionPoolStatistics().getMaximumAvailableConnections()); metricMap.put(prefix + ".numAvailableConnections", (Gauge<Integer>) () -> pool.getConnectionPoolStatistics().getNumAvailableConnections()); metricMap.put(prefix + ".numConnectionsClosedDefunct", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumConnectionsClosedDefunct()); metricMap.put(prefix + ".numConnectionsClosedExpired", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumConnectionsClosedExpired()); metricMap.put(prefix + ".numConnectionsClosedUnneeded", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumConnectionsClosedUnneeded()); metricMap.put(prefix + ".numFailedCheckouts", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumFailedCheckouts()); metricMap.put(prefix + ".numFailedConnectionAttempts", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumFailedConnectionAttempts()); metricMap.put(prefix + ".numReleasedValid", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumReleasedValid()); metricMap.put(prefix + ".numSuccessfulCheckouts", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumSuccessfulCheckouts()); metricMap.put(prefix + ".numSuccessfulCheckoutsNewConnection", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumSuccessfulCheckoutsNewConnection()); metricMap.put(prefix + ".numSuccessfulCheckoutsWithoutWaiting", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumSuccessfulCheckoutsWithoutWaiting()); metricMap.put(prefix + ".numSuccessfulCheckoutsAfterWaiting", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumSuccessfulCheckoutsAfterWaiting()); metricMap.put(prefix + ".numSuccessfulConnectionAttempts", (Gauge<Long>) () -> pool.getConnectionPoolStatistics().getNumSuccessfulConnectionAttempts()); }
public void logConnectionProviderStatistic(PersistenceEntryManager ldapEntryManager, String connectionProviderName, String bindConnectionProviderName) { PersistenceOperationService persistenceOperationService = ldapEntryManager.getOperationService(); if (!(persistenceOperationService instanceof LdapOperationService)) { return; } LdapConnectionProvider ldapConnectionProvider = ((LdapOperationService) persistenceOperationService).getConnectionProvider(); LdapConnectionProvider bindLdapConnectionProvider = ((LdapOperationService) persistenceOperationService).getBindConnectionProvider(); if (ldapConnectionProvider == null) { log.error("{} is empty", connectionProviderName); } else { if (ldapConnectionProvider.getConnectionPool() == null) { log.error("{} is empty", connectionProviderName); } else { log.info("{} statistics: {}", connectionProviderName, ldapConnectionProvider.getConnectionPool().getConnectionPoolStatistics()); } } if (bindLdapConnectionProvider == null) { log.error("{} is empty", bindConnectionProviderName); } else { if (bindLdapConnectionProvider.getConnectionPool() == null) { log.error("{} is empty", bindConnectionProviderName); } else { log.info("{} statistics: {}", bindConnectionProviderName, bindLdapConnectionProvider.getConnectionPool().getConnectionPoolStatistics()); } } }