leventov commented on a change in pull request #8157: Enum of ResponseContext 
keys
URL: https://github.com/apache/incubator-druid/pull/8157#discussion_r307383562
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/server/QueryResource.java
 ##########
 @@ -252,24 +252,30 @@ public void write(OutputStream outputStream) throws 
WebApplicationException
             )
             .header("X-Druid-Query-Id", queryId);
 
-        if (responseContext.get(ResponseContext.CTX_ETAG) != null) {
-          builder.header(HEADER_ETAG, 
responseContext.get(ResponseContext.CTX_ETAG));
-          responseContext.remove(ResponseContext.CTX_ETAG);
+        if (responseContext.get(ResponseContext.Key.ETAG) != null) {
+          builder.header(HEADER_ETAG, 
responseContext.get(ResponseContext.Key.ETAG));
+          responseContext.remove(ResponseContext.Key.ETAG);
         }
 
         DirectDruidClient.removeMagicResponseContextFields(responseContext);
 
         //Limit the response-context header, see 
https://github.com/apache/incubator-druid/issues/2331
         //Note that Response.ResponseBuilder.header(String key,Object 
value).build() calls value.toString()
         //and encodes the string using ASCII, so 1 char is = 1 byte
-        String responseCtxString = responseContext.serializeWith(jsonMapper);
-        if (responseCtxString.length() > RESPONSE_CTX_HEADER_LEN_LIMIT) {
-          log.warn("Response Context truncated for id [%s] . Full context is 
[%s].", queryId, responseCtxString);
-          responseCtxString = responseCtxString.substring(0, 
RESPONSE_CTX_HEADER_LEN_LIMIT);
+        final ResponseContext.SerializationResult serializationResult = 
responseContext.serializeWith(
+            jsonMapper,
+            RESPONSE_CTX_HEADER_LEN_LIMIT
+        );
+        if (serializationResult.isReduced()) {
+          log.warn(
 
 Review comment:
   Should Druid cluster operators monitor these messages? Can they do anything 
about them? If not, this should probably be `info()`. See #7362.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to