Jane He created CASSJAVA-97:
-------------------------------

             Summary: Let users inject an ID for each request and write to the 
custom payload 
                 Key: CASSJAVA-97
                 URL: https://issues.apache.org/jira/browse/CASSJAVA-97
             Project: Apache Cassandra Java driver
          Issue Type: Improvement
            Reporter: Jane He
            Assignee: Jane He


Currently `CqlRequestHandler` creates `logPrefix` to identify each request, but 
this logPrefix generation logic is fixed and built-in. We should expose an 
interface to let the users generate and inject whatever ID they want. We should 
also enable an option to write such ID to the custom payload, so that this ID 
can be propagated to the server side for better traceability. This feature will 
be specifically useful for Astra.  

I propose the following interface
{code:java}
public interface DistributedTraceIdGenerator {
  String getSessionRequestId(@NonNull Request statement);

  String getNodeRequestId(@NonNull Request statement, @Nullable String 
sessionRequestId);
}
 {code}
And the following options in application.conf
{code:java}
advanced.distributed-tracing{
  id-generator{
    # The component that generates unique identifiers for distributed tracing.
    class = NoopDistributedTraceIdGenerator
  }
  # add the trace-id to the custom payload with the given key
  # if empty, the trace-id will not be added to the custom payload
  custom-payload-with-key = ""
} {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to