mirror of https://github.com/apache/druid.git
Merge pull request #2161 from metamx/query-metrics-timeout
Fix Query metrics for query timeout
This commit is contained in:
commit
01a0715ee2
|
@ -322,6 +322,7 @@ public class AsyncQueryForwardingServlet extends AsyncProxyServlet
|
||||||
requestTime,
|
requestTime,
|
||||||
"success",
|
"success",
|
||||||
result.isSucceeded()
|
result.isSucceeded()
|
||||||
|
&& result.getResponse().getStatus() == javax.ws.rs.core.Response.Status.OK.getStatusCode()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -194,6 +194,7 @@ public class QueryResource
|
||||||
final long queryTime = System.currentTimeMillis() - start;
|
final long queryTime = System.currentTimeMillis() - start;
|
||||||
emitter.emit(
|
emitter.emit(
|
||||||
DruidMetrics.makeQueryTimeMetric(jsonMapper, theQuery, req.getRemoteAddr())
|
DruidMetrics.makeQueryTimeMetric(jsonMapper, theQuery, req.getRemoteAddr())
|
||||||
|
.setDimension("success", "true")
|
||||||
.build("query/time", queryTime)
|
.build("query/time", queryTime)
|
||||||
);
|
);
|
||||||
emitter.emit(
|
emitter.emit(
|
||||||
|
@ -236,6 +237,12 @@ public class QueryResource
|
||||||
catch (QueryInterruptedException e) {
|
catch (QueryInterruptedException e) {
|
||||||
try {
|
try {
|
||||||
log.info("%s [%s]", e.getMessage(), queryId);
|
log.info("%s [%s]", e.getMessage(), queryId);
|
||||||
|
final long queryTime = System.currentTimeMillis() - start;
|
||||||
|
emitter.emit(
|
||||||
|
DruidMetrics.makeQueryTimeMetric(jsonMapper, query, req.getRemoteAddr())
|
||||||
|
.setDimension("success", "false")
|
||||||
|
.build("query/time", queryTime)
|
||||||
|
);
|
||||||
requestLogger.log(
|
requestLogger.log(
|
||||||
new RequestLogLine(
|
new RequestLogLine(
|
||||||
new DateTime(),
|
new DateTime(),
|
||||||
|
@ -243,6 +250,8 @@ public class QueryResource
|
||||||
query,
|
query,
|
||||||
new QueryStats(
|
new QueryStats(
|
||||||
ImmutableMap.<String, Object>of(
|
ImmutableMap.<String, Object>of(
|
||||||
|
"query/time",
|
||||||
|
queryTime,
|
||||||
"success",
|
"success",
|
||||||
false,
|
false,
|
||||||
"interrupted",
|
"interrupted",
|
||||||
|
@ -275,12 +284,25 @@ public class QueryResource
|
||||||
log.warn(e, "Exception occurred on request [%s]", queryString);
|
log.warn(e, "Exception occurred on request [%s]", queryString);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
final long queryTime = System.currentTimeMillis() - start;
|
||||||
|
emitter.emit(
|
||||||
|
DruidMetrics.makeQueryTimeMetric(jsonMapper, query, req.getRemoteAddr())
|
||||||
|
.setDimension("success", "false")
|
||||||
|
.build("query/time", queryTime)
|
||||||
|
);
|
||||||
requestLogger.log(
|
requestLogger.log(
|
||||||
new RequestLogLine(
|
new RequestLogLine(
|
||||||
new DateTime(),
|
new DateTime(),
|
||||||
req.getRemoteAddr(),
|
req.getRemoteAddr(),
|
||||||
query,
|
query,
|
||||||
new QueryStats(ImmutableMap.<String, Object>of("success", false, "exception", e.toString()))
|
new QueryStats(ImmutableMap.<String, Object>of(
|
||||||
|
"query/time",
|
||||||
|
queryTime,
|
||||||
|
"success",
|
||||||
|
false,
|
||||||
|
"exception",
|
||||||
|
e.toString()
|
||||||
|
))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue