public static class QueryLogger.Builder extends Object
QueryLogger
instances with a fluent API.Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
QueryLogger |
build()
Build the
QueryLogger instance. |
QueryLogger.Builder |
withConstantThreshold(long slowQueryLatencyThresholdMillis)
Enables slow query latency tracking based on constant thresholds.
|
QueryLogger.Builder |
withDynamicThreshold(PerHostPercentileTracker perHostPercentileLatencyTracker,
double slowQueryLatencyThresholdPercentile)
Enables slow query latency tracking based on dynamic thresholds.
|
QueryLogger.Builder |
withMaxLoggedParameters(int maxLoggedParameters)
Set the maximum number of query parameters that can be logged
by the driver.
|
QueryLogger.Builder |
withMaxParameterValueLength(int maxParameterValueLength)
Set the maximum length of a query parameter value that can be logged verbatim
by the driver.
|
QueryLogger.Builder |
withMaxQueryStringLength(int maxQueryStringLength)
Set the maximum length of a CQL query string that can be logged verbatim
by the driver.
|
public QueryLogger.Builder withConstantThreshold(long slowQueryLatencyThresholdMillis)
constant thresholds
or dynamic thresholds
,
not both.slowQueryLatencyThresholdMillis
- The threshold in milliseconds beyond which queries are considered 'slow'
and logged as such by the driver.
The default value is QueryLogger.DEFAULT_SLOW_QUERY_THRESHOLD_MS
QueryLogger.Builder
instance (for method chaining).@Beta public QueryLogger.Builder withDynamicThreshold(PerHostPercentileTracker perHostPercentileLatencyTracker, double slowQueryLatencyThresholdPercentile)
PerHostPercentileTracker
.
Note: You should either use constant thresholds
or dynamic thresholds
,
not both.
This feature is currently provided as a beta preview: it hasn't been extensively tested yet, and the API is still subject
to change.perHostPercentileLatencyTracker
- the PerHostPercentileTracker
instance to use for recording per-host latency histograms.
Cannot be null
.slowQueryLatencyThresholdPercentile
- Slow queries threshold percentile.
It must be comprised between 0 inclusive and 100 exclusive.
The default value is QueryLogger.DEFAULT_SLOW_QUERY_THRESHOLD_PERCENTILE
QueryLogger.Builder
instance (for method chaining).public QueryLogger.Builder withMaxQueryStringLength(int maxQueryStringLength)
maxQueryStringLength
- The maximum length of a CQL query string
that can be logged verbatim by the driver.
It must be strictly positive or -1
,
in which case the query is never truncated
(use with care).
The default value is QueryLogger.DEFAULT_MAX_QUERY_STRING_LENGTH
.QueryLogger.Builder
instance (for method chaining).public QueryLogger.Builder withMaxParameterValueLength(int maxParameterValueLength)
maxParameterValueLength
- The maximum length of a query parameter value
that can be logged verbatim by the driver.
It must be strictly positive or -1
,
in which case the parameter value is never truncated
(use with care).
The default value is QueryLogger.DEFAULT_MAX_PARAMETER_VALUE_LENGTH
.QueryLogger.Builder
instance (for method chaining).public QueryLogger.Builder withMaxLoggedParameters(int maxLoggedParameters)
maxLoggedParameters
- The maximum number of query parameters that can be logged
by the driver. It must be strictly positive or -1
,
in which case all parameters will be logged, regardless of their number
(use with care).
The default value is QueryLogger.DEFAULT_MAX_LOGGED_PARAMETERS
.QueryLogger.Builder
instance (for method chaining).public QueryLogger build()
QueryLogger
instance.QueryLogger
instance.IllegalArgumentException
- if the builder is unable to build a valid instance due to incorrect settings.