Class CTSMonitoringStoreImpl
- java.lang.Object
-
- org.forgerock.openam.cts.monitoring.impl.CTSMonitoringStoreImpl
-
- All Implemented Interfaces:
CTSConnectionMonitoringStore,CTSOperationsMonitoringStore,CTSReaperMonitoringStore
@Singleton public class CTSMonitoringStoreImpl extends Object implements CTSOperationsMonitoringStore, CTSReaperMonitoringStore, CTSConnectionMonitoringStore
An implementation of the CTSOperationsMonitoringStore that stores the CTS monitoring information in internal data structure based on the type of monitoring information being stored.- Since:
- 12.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXECUTOR_BINDING_NAMEConstant for binding an Executor for the CTS monitoring store to store CTS runtime data.
-
Constructor Summary
Constructors Constructor Description CTSMonitoringStoreImpl(ExecutorService executorService, TokenOperationsStore tokenOperationsStore, ReaperMonitor reaperMonitor, ConnectionStore connectionStore, Debug debug)Constructs an instance of the CTSMonitoringStoreImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnection(boolean success)Adds a connection attempt event into the monitoring store.voidaddReaperRun(long startTime, long runTime, long numberOfDeletedSessions)Adds a CTS Reaper run to the monitoring store.voidaddTokenOperation(Token token, CTSOperation operation, boolean success)Adds a Token operation into the monitoring store.doublegetAverageConnectionsPerPeriod(boolean success)Gets the average number of connections requested from the pool in a given interval.doublegetAverageOperationFailuresPerPeriod(CTSOperation operation)Gets the average failure rate for the given operation in the current period.doublegetAverageOperationsPerPeriod(TokenType type, CTSOperation operation)Gets the average rate of operations made in a given period.doublegetConnectionsCumulativeCount(boolean success)Gets the total count of connections requested from the pool in a given interval.longgetMaximumOperationFailuresPerPeriod(CTSOperation operation)Gets the maximum observed failure rate for the given operation in the current period.doublegetMaximumOperationsPerPeriod(boolean success)Gets the maximum number of connections requested from the pool in a given interval.longgetMaximumOperationsPerPeriod(TokenType type, CTSOperation operation)Gets the maximum rate of operations made in a given period.longgetMinimumOperationFailuresPerPeriod(CTSOperation operation)Gets the minimum observed failure rate for the given operation in the current period.doublegetMinimumOperationsPerPeriod(boolean success)Gets the minimum number of connections requested from the pool in a given interval.longgetMinimumOperationsPerPeriod(TokenType type, CTSOperation operation)Gets the minimum rate of operations made in a given period.longgetOperationFailuresCumulativeCount(CTSOperation operation)Gets the cumulative count of failures of this operation type since server startup.longgetOperationsCumulativeCount(TokenType type, CTSOperation operation)Gets the cumulative count of operations made since server start up.doublegetRateOfDeletedSessions()Gets the average rate of deletion based from all of the reaper runs since server start up.
-
-
-
Field Detail
-
EXECUTOR_BINDING_NAME
public static final String EXECUTOR_BINDING_NAME
Constant for binding an Executor for the CTS monitoring store to store CTS runtime data.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CTSMonitoringStoreImpl
@Inject public CTSMonitoringStoreImpl(@Named("MONITORING_EXECUTOR") ExecutorService executorService, TokenOperationsStore tokenOperationsStore, ReaperMonitor reaperMonitor, ConnectionStore connectionStore, @Named("amCoreTokenService") Debug debug)Constructs an instance of the CTSMonitoringStoreImpl.- Parameters:
debug- An instance of the debug logger.executorService- An instance of an ExecutorService.tokenOperationsStore- An instance of the TokenOperationsStore.reaperMonitor- An instance of the ReaperMonitor.
-
-
Method Detail
-
addTokenOperation
public void addTokenOperation(Token token, CTSOperation operation, boolean success)
Adds a Token operation into the monitoring store.
The operation is mapped to the type of the token. The operations per configurable period and cumulative count will be updated for the token type and operation.
Passing innullas the token will mean that the operation is not mapped to a particular token type, this is for operations such as delete and list as the type of token cannot be determined. The operations per configurable period and cumulative count will be updated for the operation.- Specified by:
addTokenOperationin interfaceCTSOperationsMonitoringStore- Parameters:
token- The Token the operation was performed on.operation- The operation performed.success- Whether the operation was successful or not.
-
getAverageOperationsPerPeriod
public double getAverageOperationsPerPeriod(TokenType type, CTSOperation operation)
Gets the average rate of operations made in a given period.
Will return the number of the specified operation made on the specified type token in a given (configurable) period.
Passing innullas the operation will mean that the method will return the number of the specified operation made on tokens, which the type cannot be determined, i.e. Delete and List operations.- Specified by:
getAverageOperationsPerPeriodin interfaceCTSOperationsMonitoringStore- Parameters:
type- The type of token to get the operation average rate for.operation- The operation to get the average rate for.- Returns:
- The average number of operations made on the type token in a given period.
-
getMinimumOperationsPerPeriod
public long getMinimumOperationsPerPeriod(TokenType type, CTSOperation operation)
Gets the minimum rate of operations made in a given period.
Will return the number of the specified operation made on the specified type token in a given (configurable) period.
Passing innullas the operation will mean that the method will return the number of the specified operation made on tokens, which the type cannot be determined, i.e. Delete and List operations.- Specified by:
getMinimumOperationsPerPeriodin interfaceCTSOperationsMonitoringStore- Parameters:
type- The type of token to get the operation minimum rate for.operation- The operation to get the minimum rate for.- Returns:
- The minimum number of operations made on the type token in a given period.
-
getMaximumOperationsPerPeriod
public long getMaximumOperationsPerPeriod(TokenType type, CTSOperation operation)
Gets the maximum rate of operations made in a given period.
Will return the number of the specified operation made on the specified type token in a given (configurable) period.
Passing innullas the operation will mean that the method will return the number of the specified operation made on tokens, which the type cannot be determined, i.e. Delete and List operations.- Specified by:
getMaximumOperationsPerPeriodin interfaceCTSOperationsMonitoringStore- Parameters:
type- The type of token to get the operation maximum rate for.operation- The operation to get the maximum rate for.- Returns:
- The maximum number of operations made on the type token in a given period.
-
getOperationsCumulativeCount
public long getOperationsCumulativeCount(TokenType type, CTSOperation operation)
Gets the cumulative count of operations made since server start up.
Will return the total number of the specified operation made on the specified type of token since the server stared.
Passing innullas the operation will mean that the method will return the total number of the specified operation made on tokens, which the type cannot be determined, i.e. Delete and List operations.- Specified by:
getOperationsCumulativeCountin interfaceCTSOperationsMonitoringStore- Parameters:
type- The type of token to get the cumulative count for.operation- The operation to get the cumulative count for.- Returns:
- The total number of operations made on the type of token since server start up.
-
getOperationFailuresCumulativeCount
public long getOperationFailuresCumulativeCount(CTSOperation operation)
Gets the cumulative count of failures of this operation type since server startup.
Note that failure counts are not distinguished by token type as in most failure cases this information is not available. Uses theTokenOperationsStoreto return the cumulative failure count.- Specified by:
getOperationFailuresCumulativeCountin interfaceCTSOperationsMonitoringStore- Parameters:
operation- The operation to get the failure count for.- Returns:
- The total number of failed operations of this type since server startup.
-
getAverageOperationFailuresPerPeriod
public double getAverageOperationFailuresPerPeriod(CTSOperation operation)
Description copied from interface:CTSOperationsMonitoringStoreGets the average failure rate for the given operation in the current period.- Specified by:
getAverageOperationFailuresPerPeriodin interfaceCTSOperationsMonitoringStore- Parameters:
operation- the operation to get the failure rate for.- Returns:
- the average failure rate of the given operation in the current monitoring period.
-
getMinimumOperationFailuresPerPeriod
public long getMinimumOperationFailuresPerPeriod(CTSOperation operation)
Description copied from interface:CTSOperationsMonitoringStoreGets the minimum observed failure rate for the given operation in the current period.- Specified by:
getMinimumOperationFailuresPerPeriodin interfaceCTSOperationsMonitoringStore- Parameters:
operation- the operation to get the failure rate for.- Returns:
- the minimum observed failure rate of the given operation in the current monitoring period.
-
getMaximumOperationFailuresPerPeriod
public long getMaximumOperationFailuresPerPeriod(CTSOperation operation)
Description copied from interface:CTSOperationsMonitoringStoreGets the maximum observed failure rate for the given operation in the current period.- Specified by:
getMaximumOperationFailuresPerPeriodin interfaceCTSOperationsMonitoringStore- Parameters:
operation- the operation to get the failure rate for.- Returns:
- the maximum observed failure rate of the given operation in the current monitoring period.
-
addReaperRun
public void addReaperRun(long startTime, long runTime, long numberOfDeletedSessions)Adds a CTS Reaper run to the monitoring store.- Specified by:
addReaperRunin interfaceCTSReaperMonitoringStore- Parameters:
startTime- The start time of the reaper run.runTime- The end time of the reaper run.numberOfDeletedSessions- The total number of deleted sessions.
-
getRateOfDeletedSessions
public double getRateOfDeletedSessions()
Gets the average rate of deletion based from all of the reaper runs since server start up.- Specified by:
getRateOfDeletedSessionsin interfaceCTSReaperMonitoringStore- Returns:
- The rate of session deletion by the CTS Reaper.
-
addConnection
public void addConnection(boolean success)
Description copied from interface:CTSConnectionMonitoringStoreAdds a connection attempt event into the monitoring store.- Specified by:
addConnectionin interfaceCTSConnectionMonitoringStore- Parameters:
success- True to increment number of successful connections made through this pool, false for failure
-
getAverageConnectionsPerPeriod
public double getAverageConnectionsPerPeriod(boolean success)
Description copied from interface:CTSConnectionMonitoringStoreGets the average number of connections requested from the pool in a given interval.- Specified by:
getAverageConnectionsPerPeriodin interfaceCTSConnectionMonitoringStore- Parameters:
success- True to get average number of successful connections, false for average number of connection requests rejected- Returns:
- The average number of connections in a given period.
-
getMinimumOperationsPerPeriod
public double getMinimumOperationsPerPeriod(boolean success)
Description copied from interface:CTSConnectionMonitoringStoreGets the minimum number of connections requested from the pool in a given interval.- Specified by:
getMinimumOperationsPerPeriodin interfaceCTSConnectionMonitoringStore- Parameters:
success- True to get minimum number of successful connections, false for minimum number of connection requests rejected- Returns:
- The minimum number of connections in a given period.
-
getMaximumOperationsPerPeriod
public double getMaximumOperationsPerPeriod(boolean success)
Description copied from interface:CTSConnectionMonitoringStoreGets the maximum number of connections requested from the pool in a given interval.- Specified by:
getMaximumOperationsPerPeriodin interfaceCTSConnectionMonitoringStore- Parameters:
success- True to get maximum number of successful connections, false for maximum number of connection requests rejected- Returns:
- The maximum number of connections in a given period.
-
getConnectionsCumulativeCount
public double getConnectionsCumulativeCount(boolean success)
Description copied from interface:CTSConnectionMonitoringStoreGets the total count of connections requested from the pool in a given interval.- Specified by:
getConnectionsCumulativeCountin interfaceCTSConnectionMonitoringStore- Parameters:
success- True to get total count of successful connections, false for total count of connection requests rejected- Returns:
- The total count of connections in a given period.
-
-