Tracks request execution for a Client.

A RequestTracker can be configured in the client options. The Client will execute RequestTracker#onSuccess or RequestTracker#onError for every query or batch executed (QUERY, EXECUTE and BATCH requests).

Methods

onError

(Host host, String or Array query, Array, Object or null parameters, ExecutionOptions executionOptions, Number requestLength, Error err, Array<Number> latency)

Invoked each time a query or batch request fails.

Parameters:
Name Type Description
host Host

The node that acted as coordinator of the request.

query String or Array

In the case of prepared or unprepared query executions, the provided query string. For batch requests, an Array containing the queries and parameters provided.

parameters Array, Object or null

In the case of prepared or unprepared query executions, the provided parameters.

executionOptions ExecutionOptions

The information related to the execution of the request.

requestLength Number

Length of the body of the request. When the failure occurred before the request was written to the wire, the length will be 0.

err Error

The error that caused that caused the request to fail.

latency Array<Number>

An array containing [seconds, nanoseconds] tuple, where nanoseconds is the remaining part of the real time that can’t be represented in second precision (see process.hrtime()).

onSuccess

(Host host, String or Array query, Array, Object or null parameters, ExecutionOptions executionOptions, Number requestLength, Number responseLength, Array<Number> latency)

Invoked each time a query or batch request succeeds.

Parameters:
Name Type Description
host Host

The node that acted as coordinator of the request.

query String or Array

In the case of prepared or unprepared query executions, the provided query string. For batch requests, an Array containing the queries and parameters provided.

parameters Array, Object or null

In the case of prepared or unprepared query executions, the provided parameters.

executionOptions ExecutionOptions

The information related to the execution of the request.

requestLength Number

Length of the body of the request.

responseLength Number

Length of the body of the response.

latency Array<Number>

An array containing [seconds, nanoseconds] tuple, where nanoseconds is the remaining part of the real time that can’t be represented in second precision (see process.hrtime()).

shutdown

()

Invoked when the Client is being shutdown.