Improve some log (#2807)

This commit is contained in:
binlijin 2016-04-16 00:34:26 +08:00 committed by Fangjin Yang
parent 632b21472b
commit c1e690288c
2 changed files with 13 additions and 4 deletions

View File

@ -160,7 +160,7 @@ public class DirectDruidClient<T> implements QueryRunner<T>
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 class DirectDruidClient<T> implements QueryRunner<T>
@Override
public ClientResponse<InputStream> 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 class DirectDruidClient<T> implements QueryRunner<T>
{
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,

View File

@ -107,9 +107,11 @@ public class 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 class QueryResource
? 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 class QueryResource
);
}
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 class QueryResource
)
).build();
}
finally {
Thread.currentThread().setName(currThreadName);
}
}
}