diff --git a/server/src/main/java/io/druid/client/DirectDruidClient.java b/server/src/main/java/io/druid/client/DirectDruidClient.java index 9f26b1de48ef..198171e899d1 100644 --- a/server/src/main/java/io/druid/client/DirectDruidClient.java +++ b/server/src/main/java/io/druid/client/DirectDruidClient.java @@ -160,7 +160,7 @@ public Sequence run(final Query query, final Map context) final String cancelUrl = String.format("http://%s/druid/v2/%s", host, query.getId()); try { - log.debug("Querying url[%s]", url); + log.debug("Querying queryId[%s] url[%s]", query.getId(), url); final long requestStartTime = System.currentTimeMillis(); @@ -179,7 +179,7 @@ public Sequence run(final Query query, final Map context) @Override public ClientResponse handleResponse(HttpResponse response) { - log.debug("Initial response from url[%s]", url); + log.debug("Initial response from url[%s] for queryId[%s]", url, query.getId()); responseStartTime = System.currentTimeMillis(); emitter.emit(builder.build("query/node/ttfb", responseStartTime - requestStartTime)); @@ -272,7 +272,8 @@ public ClientResponse done(ClientResponse clientRespon { long stopTime = System.currentTimeMillis(); log.debug( - "Completed request to url[%s] with %,d bytes returned in %,d millis [%,f b/s].", + "Completed queryId[%s] request to url[%s] with %,d bytes returned in %,d millis [%,f b/s].", + query.getId(), url, byteCount.get(), stopTime - responseStartTime, diff --git a/server/src/main/java/io/druid/server/QueryResource.java b/server/src/main/java/io/druid/server/QueryResource.java index 039360ea7154..0b9ac2b0fa50 100644 --- a/server/src/main/java/io/druid/server/QueryResource.java +++ b/server/src/main/java/io/druid/server/QueryResource.java @@ -107,9 +107,11 @@ public QueryResource( @Produces(MediaType.APPLICATION_JSON) public Response getServer(@PathParam("id") String queryId) { + if (log.isDebugEnabled()) { + log.debug("Received cancel request for query [%s]", queryId); + } queryManager.cancelQuery(queryId); return Response.status(Response.Status.ACCEPTED).build(); - } @POST @@ -135,6 +137,7 @@ public Response doPost( ? objectMapper.writerWithDefaultPrettyPrinter() : objectMapper.writer(); + final String currThreadName = Thread.currentThread().getName(); try { query = objectMapper.readValue(in, Query.class); queryId = query.getId(); @@ -151,6 +154,8 @@ public Response doPost( ); } + Thread.currentThread() + .setName(String.format("%s[%s_%s_%s]", currThreadName, query.getType(), query.getDataSource(), queryId)); if (log.isDebugEnabled()) { log.debug("Got query [%s]", query); } @@ -337,5 +342,8 @@ public void write(OutputStream outputStream) throws IOException, WebApplicationE ) ).build(); } + finally { + Thread.currentThread().setName(currThreadName); + } } }