Class QueryStatManager
java.lang.Object
com.kingsrook.qqq.backend.core.actions.tables.helpers.QueryStatManager
Singleton, which starts a thread, to store query stats into a table.
Supports these systemProperties or ENV_VARS:
qqq.queryStatManager.enabled / QQQ_QUERY_STAT_MANAGER_ENABLED
qqq.queryStatManager.minMillisToStore / QQQ_QUERY_STAT_MANAGER_MIN_MILLIS_TO_STORE
qqq.queryStatManager.jobPeriodSeconds / QQQ_QUERY_STAT_MANAGER_JOB_PERIOD_SECONDS
qqq.queryStatManager.jobInitialDelay / QQQ_QUERY_STAT_MANAGER_JOB_INITIAL_DELAY
-
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddQueryStatConsumer(QueryStatConsumerInterface queryStatConsumer) add one query stat consumer to the list.org.apache.logging.log4j.LevelGetter for emptyActionStackLogLevelstatic QueryStatManagerSingleton accessorintGetter for jobInitialDelayintGetter for jobPeriodSecondsintGetter for minMillisToStoreGetter for queryStatConsumersstatic QueryStatnewQueryStat(QBackendMetaData backend, QTableMetaData table, QQueryFilter filter, String backendActionName) voidsetEmptyActionStackLogLevel(org.apache.logging.log4j.Level emptyActionStackLogLevel) Setter for emptyActionStackLogLevelvoidsetJobInitialDelay(int jobInitialDelay) Setter for jobInitialDelayvoidsetJobPeriodSeconds(int jobPeriodSeconds) Setter for jobPeriodSecondsvoidsetMinMillisToStore(int minMillisToStore) Setter for minMillisToStorevoidsetQueryStatConsumers(List<QueryStatConsumerInterface> queryStatConsumers) Setter for queryStatConsumersvoidvoidstop()voidforce stats to be stored right now (rather than letting the scheduled job do it)withEmptyActionStackLogLevel(org.apache.logging.log4j.Level emptyActionStackLogLevel) Fluent setter for emptyActionStackLogLevelwithJobInitialDelay(int jobInitialDelay) Fluent setter for jobInitialDelaywithJobPeriodSeconds(int jobPeriodSeconds) Fluent setter for jobPeriodSecondswithMinMillisToStore(int minMillisToStore) Fluent setter for minMillisToStorewithQueryStatConsumers(List<QueryStatConsumerInterface> queryStatConsumers) Fluent setter for queryStatConsumers
-
Method Details
-
getInstance
Singleton accessor -
newQueryStat
public static QueryStat newQueryStat(QBackendMetaData backend, QTableMetaData table, QQueryFilter filter, String backendActionName) -
start
-
stop
public void stop() -
add
-
storeStatsNow
public void storeStatsNow()force stats to be stored right now (rather than letting the scheduled job do it) -
getJobPeriodSeconds
public int getJobPeriodSeconds()Getter for jobPeriodSeconds -
setJobPeriodSeconds
public void setJobPeriodSeconds(int jobPeriodSeconds) Setter for jobPeriodSeconds -
withJobPeriodSeconds
Fluent setter for jobPeriodSeconds -
getJobInitialDelay
public int getJobInitialDelay()Getter for jobInitialDelay -
setJobInitialDelay
public void setJobInitialDelay(int jobInitialDelay) Setter for jobInitialDelay -
withJobInitialDelay
Fluent setter for jobInitialDelay -
getMinMillisToStore
public int getMinMillisToStore()Getter for minMillisToStore -
setMinMillisToStore
public void setMinMillisToStore(int minMillisToStore) Setter for minMillisToStore -
withMinMillisToStore
Fluent setter for minMillisToStore -
getQueryStatConsumers
Getter for queryStatConsumers- See Also:
-
setQueryStatConsumers
Setter for queryStatConsumers- See Also:
-
withQueryStatConsumers
Fluent setter for queryStatConsumers- Parameters:
queryStatConsumers- List of instances of QueryStateConsumerInterface - e.g., classes that want to be invoked when a query stat object is being added to the manager here (e.g., after its query is complete).- Returns:
- this
-
addQueryStatConsumer
add one query stat consumer to the list.- See Also:
-
getEmptyActionStackLogLevel
public org.apache.logging.log4j.Level getEmptyActionStackLogLevel()Getter for emptyActionStackLogLevel- See Also:
-
setEmptyActionStackLogLevel
public void setEmptyActionStackLogLevel(org.apache.logging.log4j.Level emptyActionStackLogLevel) Setter for emptyActionStackLogLevel- See Also:
-
withEmptyActionStackLogLevel
public QueryStatManager withEmptyActionStackLogLevel(org.apache.logging.log4j.Level emptyActionStackLogLevel) Fluent setter for emptyActionStackLogLevel- Parameters:
emptyActionStackLogLevel- log level to use to log out if there's ever a query stat being recorded when the actionStack in QContext is empty.Originally that was thought to be an unexpected condition, so it used to always warn. but, it turns out to be more common maybe, and not necessarily of any concern, so the default level is OFF - but it can be upgraded by setting this property.
- Returns:
- this
-