Package com.datastax.driver.core
Interface LatencyTracker
-
- All Known Implementing Classes:
ClusterWidePercentileTracker,PercentileTracker,PerHostPercentileTracker,QueryLogger,QueryLogger.ConstantThresholdQueryLogger,QueryLogger.DynamicThresholdQueryLogger
public interface LatencyTrackerInterface for objects that are interested in tracking the latencies of the driver queries to each Cassandra nodes.An implementation of this interface can be registered against a Cluster object trough the
Cluster.register(com.datastax.driver.core.Host.StateListener)method, after which theupdate(Host, Statement, Exception, long)method will be called after each query of the driver to a Cassandra host with the latency/duration (in nanoseconds) of this operation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonRegister(Cluster cluster)Gets invoked when the tracker is registered with a cluster, or at cluster startup if the tracker was registered at initialization withCluster.register(LatencyTracker).voidonUnregister(Cluster cluster)Gets invoked when the tracker is unregistered from a cluster, or at cluster shutdown if the tracker was not unregistered.voidupdate(Host host, Statement statement, Exception exception, long newLatencyNanos)A method that is called after each request to a Cassandra node with the duration of that operation.
-
-
-
Method Detail
-
update
void update(Host host, Statement statement, Exception exception, long newLatencyNanos)
A method that is called after each request to a Cassandra node with the duration of that operation.Note that there is no guarantee that this method won't be called concurrently by multiple threads, so implementations should synchronize internally if need be.
- Parameters:
host- The Cassandra host on which a request has been performed. This parameter is nevernull.statement- TheStatementthat has been executed. This parameter is nevernull.exception- AnExceptionthrown when receiving the response, ornullif the response was successful.newLatencyNanos- the latency in nanoseconds of the operation. This latency corresponds to the time elapsed between when the query was sent tohostand when the response was received by the driver (or the operation timed out, in whichnewLatencyNanoswill approximately be the timeout value).
-
onRegister
void onRegister(Cluster cluster)
Gets invoked when the tracker is registered with a cluster, or at cluster startup if the tracker was registered at initialization withCluster.register(LatencyTracker).- Parameters:
cluster- the cluster that this tracker is registered with.
-
onUnregister
void onUnregister(Cluster cluster)
Gets invoked when the tracker is unregistered from a cluster, or at cluster shutdown if the tracker was not unregistered.- Parameters:
cluster- the cluster that this tracker was registered with.
-
-