tree: 87a9e80463d6455ca30ad07909b4faf749975f3a [path history] [tgz]
  1. README.md
manual/core/request_id/README.md

Request Id

Quick overview

Users can inject an identifier for each individual CQL request, and such ID can be written in to the custom payload to correlate a request across the driver and the Apache Cassandra server.

A request ID generator needs to generate both:

  • Session request ID: an identifier for an entire session.execute() call
  • Node request ID: an identifier for the execution of a CQL statement against a particular node. There can be one or more node requests for a single session request, due to retries or speculative executions.

Usage:

  • Inject ID generator: set the desired RequestIdGenerator in advanced.request-id.generator.class.
  • Add ID to custom payload: the default behavior of a RequestIdGenerator is to add the request ID into the custom payload with the key request-id. Override RequestIdGenerator.getDecoratedStatement to customize the behavior.

Request Id Generator Configuration

Request ID generator can be declared in the configuration as follows:

datastax-java-driver.advanced.request-id.generator {
  class = com.example.app.MyGenerator
}

To register your own request ID generator, specify the name of the class that implements RequestIdGenerator.

The generated ID will be added to the log message of CqlRequestHandler, and propagated to other classes, e.g. the request trackers.