public interface RequestTracker extends AutoCloseable
There is exactly one tracker per Session
. It can be provided either via the
configuration (see reference.conf
in the manual or core driver JAR), or programmatically
via SessionBuilder.withRequestTracker(RequestTracker)
.
Modifier and Type | Method and Description |
---|---|
default void |
onError(Request request,
Throwable error,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node)
Deprecated.
This method only exists for backward compatibility. Override
onError(Request, Throwable, long, DriverExecutionProfile, Node, String) instead. |
default void |
onError(Request request,
Throwable error,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node,
String requestLogPrefix)
Invoked each time a request fails.
|
default void |
onNodeError(Request request,
Throwable error,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node)
Deprecated.
This method only exists for backward compatibility. Override
onNodeError(Request, Throwable, long, DriverExecutionProfile, Node, String) instead. |
default void |
onNodeError(Request request,
Throwable error,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node,
String requestLogPrefix)
Invoked each time a request fails at the node level.
|
default void |
onNodeSuccess(Request request,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node)
Deprecated.
This method only exists for backward compatibility. Override
onNodeSuccess(Request, long, DriverExecutionProfile, Node, String) instead. |
default void |
onNodeSuccess(Request request,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node,
String requestLogPrefix)
Invoked each time a request succeeds at the node level.
|
default void |
onSessionReady(Session session)
Invoked when the session is ready to process user requests.
|
default void |
onSuccess(Request request,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node)
Deprecated.
This method only exists for backward compatibility. Override
onSuccess(Request, long, DriverExecutionProfile, Node, String) instead. |
default void |
onSuccess(Request request,
long latencyNanos,
DriverExecutionProfile executionProfile,
Node node,
String requestLogPrefix)
Invoked each time a request succeeds.
|
close
@Deprecated default void onSuccess(@NonNull Request request, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @NonNull Node node)
onSuccess(Request, long, DriverExecutionProfile, Node, String)
instead.default void onSuccess(@NonNull Request request, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @NonNull Node node, @NonNull String requestLogPrefix)
latencyNanos
- the overall execution time (from the session.execute
call until the result is made available to the client).executionProfile
- the execution profile of this request.node
- the node that returned the successful response.requestLogPrefix
- the dedicated log prefix for this request@Deprecated default void onError(@NonNull Request request, @NonNull Throwable error, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @Nullable Node node)
onError(Request, Throwable, long, DriverExecutionProfile, Node, String)
instead.default void onError(@NonNull Request request, @NonNull Throwable error, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @Nullable Node node, @NonNull String requestLogPrefix)
latencyNanos
- the overall execution time (from the session.execute
call until the error is propagated to the client).executionProfile
- the execution profile of this request.node
- the node that returned the error response, or null
if the error occurredrequestLogPrefix
- the dedicated log prefix for this request@Deprecated default void onNodeError(@NonNull Request request, @NonNull Throwable error, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @NonNull Node node)
onNodeError(Request, Throwable, long, DriverExecutionProfile, Node, String)
instead.default void onNodeError(@NonNull Request request, @NonNull Throwable error, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @NonNull Node node, @NonNull String requestLogPrefix)
onError(Request,
Throwable, long, DriverExecutionProfile, Node, String)
but at a per node level.latencyNanos
- the overall execution time (from the session.execute
call until the error is propagated to the client).executionProfile
- the execution profile of this request.node
- the node that returned the error response.requestLogPrefix
- the dedicated log prefix for this request@Deprecated default void onNodeSuccess(@NonNull Request request, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @NonNull Node node)
onNodeSuccess(Request, long, DriverExecutionProfile, Node, String)
instead.default void onNodeSuccess(@NonNull Request request, long latencyNanos, @NonNull DriverExecutionProfile executionProfile, @NonNull Node node, @NonNull String requestLogPrefix)
onSuccess(Request,
long, DriverExecutionProfile, Node, String)
but at per node level.latencyNanos
- the overall execution time (from the session.execute
call until the result is made available to the client).executionProfile
- the execution profile of this request.node
- the node that returned the successful response.requestLogPrefix
- the dedicated log prefix for this requestdefault void onSessionReady(@NonNull Session session)
WARNING: if you use session.execute()
in your tracker implementation, keep in
mind that those requests will in turn recurse back into onSuccess
/ onError
methods. Make sure you don't trigger an infinite loop; one way to do that is to use a
custom execution profile for internal requests.
This corresponds to the moment when SessionBuilder.build()
returns, or the future
returned by SessionBuilder.buildAsync()
completes. If the session initialization fails,
this method will not get called.
Listener methods are invoked from different threads; if you store the session in a field, make it at least volatile to guarantee proper publication.
This method is guaranteed to be the first one invoked on this object.
The default implementation is empty.
Copyright © 2017–2024. All rights reserved.