Package com.datastax.driver.core
Class QueryLogger.ConstantThresholdQueryLogger
- java.lang.Object
-
- com.datastax.driver.core.QueryLogger
-
- com.datastax.driver.core.QueryLogger.ConstantThresholdQueryLogger
-
- All Implemented Interfaces:
LatencyTracker
- Enclosing class:
- QueryLogger
public static class QueryLogger.ConstantThresholdQueryLogger extends QueryLogger
A QueryLogger that uses a constant threshold in milliseconds to track slow queries. This implementation is the default and should be preferred toQueryLogger.DynamicThresholdQueryLoggerwhich is still in beta state.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.datastax.driver.core.QueryLogger
QueryLogger.Builder, QueryLogger.ConstantThresholdQueryLogger, QueryLogger.DynamicThresholdQueryLogger
-
-
Field Summary
-
Fields inherited from class com.datastax.driver.core.QueryLogger
cluster, DEFAULT_MAX_LOGGED_PARAMETERS, DEFAULT_MAX_PARAMETER_VALUE_LENGTH, DEFAULT_MAX_QUERY_STRING_LENGTH, DEFAULT_SLOW_QUERY_THRESHOLD_MS, DEFAULT_SLOW_QUERY_THRESHOLD_PERCENTILE, ERROR_LOGGER, maxLoggedParameters, maxParameterValueLength, maxQueryStringLength, NORMAL_LOGGER, SLOW_LOGGER
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetSlowQueryLatencyThresholdMillis()Return the threshold in milliseconds beyond which queries are considered 'slow' and logged as such by the driver.protected voidmaybeLogNormalOrSlowQuery(Host host, Statement statement, long latencyMs)protected voidmaybeLogSlowQuery(Host host, Statement statement, long latencyMs)voidsetSlowQueryLatencyThresholdMillis(long slowQueryLatencyThresholdMillis)Set the threshold in milliseconds beyond which queries are considered 'slow' and logged as such by the driver.-
Methods inherited from class com.datastax.driver.core.QueryLogger
append, append, appendParameters, appendParameters, appendParameters, builder, countBoundValues, getMaxLoggedParameters, getMaxParameterValueLength, getMaxQueryStringLength, logQuery, maybeLogErrorQuery, maybeLogNormalQuery, onRegister, onUnregister, parameterValueAsString, parameterValueAsString, setMaxLoggedParameters, setMaxParameterValueLength, setMaxQueryStringLength, statementAsString, update
-
-
-
-
Method Detail
-
getSlowQueryLatencyThresholdMillis
public long getSlowQueryLatencyThresholdMillis()
Return the threshold in milliseconds beyond which queries are considered 'slow' and logged as such by the driver. The default value isQueryLogger.DEFAULT_SLOW_QUERY_THRESHOLD_MS.- Returns:
- The threshold in milliseconds beyond which queries are considered 'slow' and logged as such by the driver.
-
setSlowQueryLatencyThresholdMillis
public void setSlowQueryLatencyThresholdMillis(long slowQueryLatencyThresholdMillis)
Set the threshold in milliseconds beyond which queries are considered 'slow' and logged as such by the driver.- Parameters:
slowQueryLatencyThresholdMillis- Slow queries threshold in milliseconds. It must be strictly positive.- Throws:
IllegalArgumentException- ifslowQueryLatencyThresholdMillis <= 0.
-
maybeLogNormalOrSlowQuery
protected void maybeLogNormalOrSlowQuery(Host host, Statement statement, long latencyMs)
- Specified by:
maybeLogNormalOrSlowQueryin classQueryLogger
-
-