SiyaoIsHiding commented on code in PR #2060:
URL:
https://github.com/apache/cassandra-java-driver/pull/2060#discussion_r2492677348
##########
core/src/main/java/com/datastax/oss/driver/api/core/tracker/RequestIdGenerator.java:
##########
@@ -67,6 +67,10 @@ default String getCustomPayloadKey() {
default Statement<?> getDecoratedStatement(
@NonNull Statement<?> statement, @NonNull String requestId) {
+ // in case of retry or speculative execution
+ if (statement.getCustomPayload().containsKey(getCustomPayloadKey())) {
Review Comment:
This value in the custom payload, what we call "request-id", is not the
trace ID, it's the "traceparent" for context propagation.
| Driver concept | W3C concept | Example |
|----------------|---------------| ---------|
|Request ID value in the custom payload | traceparent (for context
propagation) | 00-4bf92f3577b34da6a3ce929d0e0e4736-a3ce929d0e0e4736-01|
|Session request ID | trace ID | 4bf92f3577b34da6a3ce929d0e0e4736 |
|The 8 bytes that we add to a session request ID to form the node request ID
| span ID| a3ce929d0e0e4736|
And the `traceparent` context propagation format is:
version "-" trace-id "-" span-id "-" trace-flags
Trace ID needs to be the same across all spans in a transaction.
Span ID is always unique. Otherwise, let's say if the driver sends out 2
requests, including a retry, both with the same node request ID. Then on the
server side, you see two identical requests, how can you tell which one is the
first, which one is the retry?
Span ID is an identifier that always need to be unique to identify each
individual operation. Trace ID is how we correlate retries and speculative
executions under one session request. The value in the custom payload needs
both, so that we can both correlate and separate different operations in one
transaction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]