This is an automated email from the ASF dual-hosted git repository.
xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 778bf298f10 Add X-Correlation-Id header to Java client HTTP requests
(#17863)
778bf298f10 is described below
commit 778bf298f10ad257d22bc6a62fe8b057c7982559
Author: nagarjuna-startree <[email protected]>
AuthorDate: Wed Mar 11 18:03:49 2026 -0700
Add X-Correlation-Id header to Java client HTTP requests (#17863)
Generate a UUID per request and send it as the X-Correlation-Id header
in JsonAsyncHttpPinotClientTransport. This enables request tracing
across proxies, load balancers, and broker access logs.
Co-authored-by: Nagarjuna Nuthalapati <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
.../org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
index a81a7e02e1c..d0a1aca1aa8 100644
---
a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
+++
b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/JsonAsyncHttpPinotClientTransport.java
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.TimeUnit;
@@ -116,8 +117,10 @@ public class JsonAsyncHttpPinotClientTransport implements
PinotClientTransport<C
if (_headers != null) {
_headers.forEach((k, v) -> requestBuilder.addHeader(k, v));
}
- LOGGER.debug("Sending query {} to {}", query, url);
- return requestBuilder.addHeader("Content-Type", "application/json;
charset=utf-8").setBody(json.toString())
+ String correlationId = UUID.randomUUID().toString();
+ LOGGER.debug("Sending query {} to {} with correlationId {}", query, url,
correlationId);
+ return requestBuilder.addHeader("Content-Type", "application/json;
charset=utf-8")
+ .addHeader("X-Correlation-Id",
correlationId).setBody(json.toString())
.execute().toCompletableFuture().thenApply(httpResponse -> {
LOGGER.debug("Completed query, HTTP status is {}",
httpResponse.getStatusCode());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]