java.lang.Object
io.lettuce.core.metrics.DefaultCommandLatencyCollector
- All Implemented Interfaces:
CommandLatencyCollector,CommandLatencyRecorder,MetricCollector<Map<CommandLatencyId,CommandMetrics>>
public class DefaultCommandLatencyCollector extends Object implements CommandLatencyCollector
Default implementation of a
CommandLatencyCollector for command latencies.- Author:
- Mark Paluch
-
Constructor Summary
Constructors Constructor Description DefaultCommandLatencyCollector(CommandLatencyCollectorOptions options) -
Method Summary
Modifier and Type Method Description static CommandLatencyCollectordisabled()Returns a disabled no-opCommandLatencyCollector.static booleanisAvailable()Returnstrueif HdrUtils and LatencyUtils are available on the class path.booleanisEnabled()Returnstrueif the metric collector is enabled.voidrecordCommandLatency(SocketAddress local, SocketAddress remote, ProtocolKeyword commandType, long firstResponseLatency, long completionLatency)Record the command latency perconnectionPointandcommandType.Map<CommandLatencyId,CommandMetrics>retrieveMetrics()Returns the collected/aggregated metrics.voidshutdown()Shut down the metrics collector.
-
Constructor Details
-
DefaultCommandLatencyCollector
-
-
Method Details
-
recordCommandLatency
public void recordCommandLatency(SocketAddress local, SocketAddress remote, ProtocolKeyword commandType, long firstResponseLatency, long completionLatency)Record the command latency perconnectionPointandcommandType.- Specified by:
recordCommandLatencyin interfaceCommandLatencyRecorder- Parameters:
local- the local addressremote- the remote addresscommandType- the command typefirstResponseLatency- latency value inTimeUnit.NANOSECONDSfrom send to the first responsecompletionLatency- latency value inTimeUnit.NANOSECONDSfrom send to the command completion
-
isEnabled
public boolean isEnabled()Description copied from interface:CommandLatencyRecorderReturnstrueif the metric collector is enabled.- Specified by:
isEnabledin interfaceCommandLatencyRecorder- Returns:
trueif the metric collector is enabled
-
shutdown
public void shutdown()Description copied from interface:MetricCollectorShut down the metrics collector.- Specified by:
shutdownin interfaceMetricCollector<Map<CommandLatencyId,CommandMetrics>>
-
retrieveMetrics
Description copied from interface:MetricCollectorReturns the collected/aggregated metrics.- Specified by:
retrieveMetricsin interfaceMetricCollector<Map<CommandLatencyId,CommandMetrics>>- Returns:
- the the collected/aggregated metrics
-
isAvailable
public static boolean isAvailable()Returnstrueif HdrUtils and LatencyUtils are available on the class path.- Returns:
-
disabled
Returns a disabled no-opCommandLatencyCollector.- Returns:
-