Package io.lettuce.core.metrics
Class MicrometerOptions.Builder
- java.lang.Object
-
- io.lettuce.core.metrics.MicrometerOptions.Builder
-
- Enclosing class:
- MicrometerOptions
public static class MicrometerOptions.Builder extends Object
Builder forMicrometerOptions
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MicrometerOptions
build()
MicrometerOptions.Builder
disable()
Disable the latency collector.MicrometerOptions.Builder
enable()
Enable the latency collector.MicrometerOptions.Builder
enabledCommands(CommandType... commands)
Sets which commands are enabled for latency recording.MicrometerOptions.Builder
histogram(boolean histogram)
Enable histogram buckets used to generate aggregable percentile approximations in monitoring systems that have query facilities to do so.MicrometerOptions.Builder
localDistinction(boolean localDistinction)
Enables per connection metrics tracking insead of per host/port.MicrometerOptions.Builder
maxLatency(Duration maxLatency)
Sets the maximum value that this timer is expected to observe.MicrometerOptions.Builder
metricsFilter(Predicate<RedisCommand<?,?,?>> filter)
Configures a filterPredicate
to filter which commands should be reported to Micrometer.MicrometerOptions.Builder
minLatency(Duration minLatency)
Sets the minimum value that this timer is expected to observe.MicrometerOptions.Builder
tags(io.micrometer.core.instrument.Tags tags)
Extra tags to add to the generated metrics.MicrometerOptions.Builder
targetPercentiles(double[] targetPercentiles)
Sets the emitted percentiles.
-
-
-
Method Detail
-
disable
public MicrometerOptions.Builder disable()
Disable the latency collector.- Returns:
- this
MicrometerOptions.Builder
.
-
enable
public MicrometerOptions.Builder enable()
Enable the latency collector.- Returns:
- this
MicrometerOptions.Builder
.
-
histogram
public MicrometerOptions.Builder histogram(boolean histogram)
Enable histogram buckets used to generate aggregable percentile approximations in monitoring systems that have query facilities to do so.- Parameters:
histogram
-true
if histogram buckets are recorded- Returns:
- this
MicrometerOptions.Builder
.
-
localDistinction
public MicrometerOptions.Builder localDistinction(boolean localDistinction)
Enables per connection metrics tracking insead of per host/port. Iftrue
, multiple connections to the same host/connection point will be recorded separately which allows to inspect every connection individually. Iffalse
, multiple connections to the same host/connection point will be recorded together. This allows a consolidated view on one particular service. Defaults tofalse
. SeeMicrometerOptions.DEFAULT_LOCAL_DISTINCTION
. Warning: Enabling this could potentially cause a label cardinality explosion in the remote metric system and should be used with caution.- Parameters:
localDistinction
-true
if latencies are recorded distinct on local level (per connection)- Returns:
- this
MicrometerOptions.Builder
.
-
enabledCommands
public MicrometerOptions.Builder enabledCommands(CommandType... commands)
Sets which commands are enabled for latency recording. Defaults to an empty list, which means all commands will be recorded. Configuring enabled commands overwritesmetricsFilter(Predicate)
.- Parameters:
commands
- list of Redis commands that are enabled for latency recording, must not benull
- Returns:
- this
MicrometerOptions.Builder
. - Since:
- 6.3
-
metricsFilter
public MicrometerOptions.Builder metricsFilter(Predicate<RedisCommand<?,?,?>> filter)
Configures a filterPredicate
to filter which commands should be reported to Micrometer.- Parameters:
filter
- the filter predicate to test commands.- Returns:
- this
MicrometerOptions.Builder
. - Since:
- 6.3
-
maxLatency
public MicrometerOptions.Builder maxLatency(Duration maxLatency)
Sets the maximum value that this timer is expected to observe. Sets an upper bound on histogram buckets that are shipped to monitoring systems that support aggregable percentile approximations. Only applicable when histogram is enabled. Defaults to5m
. SeeMicrometerOptions.DEFAULT_MAX_LATENCY
.- Parameters:
maxLatency
- the maximum value that this timer is expected to observe, must not benull
- Returns:
- this
MicrometerOptions.Builder
.
-
minLatency
public MicrometerOptions.Builder minLatency(Duration minLatency)
Sets the minimum value that this timer is expected to observe. Sets a lower bound on histogram buckets that are shipped to monitoring systems that support aggregable percentile approximations. Only applicable when histogram is enabled. Defaults to1ms
. SeeMicrometerOptions.DEFAULT_MIN_LATENCY
.- Parameters:
minLatency
- the minimum value that this timer is expected to observe- Returns:
- this
MicrometerOptions.Builder
.
-
tags
public MicrometerOptions.Builder tags(io.micrometer.core.instrument.Tags tags)
Extra tags to add to the generated metrics. Defaults toTags.empty()
.- Parameters:
tags
- tags to add to the metrics- Returns:
- this
MicrometerOptions.Builder
.
-
targetPercentiles
public MicrometerOptions.Builder targetPercentiles(double[] targetPercentiles)
Sets the emitted percentiles. Defaults to0.50, 0.90, 0.95, 0.99, 0.999
for the 50th, 90th, 95th, 99th, and 99th percentiles. Only applicable when histogram is enabled. SeeMicrometerOptions.DEFAULT_TARGET_PERCENTILES
.- Parameters:
targetPercentiles
- the percentiles which should be emitted, must not benull
- Returns:
- this
MicrometerOptions.Builder
.
-
build
public MicrometerOptions build()
- Returns:
- a new instance of
MicrometerOptions
.
-
-