mirror of https://github.com/apache/druid.git
parent
1ee4f7cc13
commit
2db3144f04
|
@ -117,7 +117,7 @@ public class QueryResource
|
||||||
public Response doPost(
|
public Response doPost(
|
||||||
InputStream in,
|
InputStream in,
|
||||||
@QueryParam("pretty") String pretty,
|
@QueryParam("pretty") String pretty,
|
||||||
@Context HttpServletRequest req // used only to get request content-type and remote address
|
@Context final HttpServletRequest req // used only to get request content-type and remote address
|
||||||
) throws IOException
|
) throws IOException
|
||||||
{
|
{
|
||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
|
@ -176,27 +176,7 @@ public class QueryResource
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
long requestTime = System.currentTimeMillis() - start;
|
final Query theQuery = query;
|
||||||
|
|
||||||
emitter.emit(
|
|
||||||
QueryMetricUtil.makeRequestTimeMetric(jsonMapper, query, req.getRemoteAddr())
|
|
||||||
.build("request/time", requestTime)
|
|
||||||
);
|
|
||||||
|
|
||||||
requestLogger.log(
|
|
||||||
new RequestLogLine(
|
|
||||||
new DateTime(),
|
|
||||||
req.getRemoteAddr(),
|
|
||||||
query,
|
|
||||||
new QueryStats(
|
|
||||||
ImmutableMap.<String, Object>of(
|
|
||||||
"request/time", requestTime,
|
|
||||||
"success", true
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return Response
|
return Response
|
||||||
.ok(
|
.ok(
|
||||||
new StreamingOutput()
|
new StreamingOutput()
|
||||||
|
@ -207,6 +187,26 @@ public class QueryResource
|
||||||
// json serializer will always close the yielder
|
// json serializer will always close the yielder
|
||||||
jsonWriter.writeValue(outputStream, yielder);
|
jsonWriter.writeValue(outputStream, yielder);
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|
||||||
|
final long requestTime = System.currentTimeMillis() - start;
|
||||||
|
emitter.emit(
|
||||||
|
QueryMetricUtil.makeRequestTimeMetric(jsonMapper, theQuery, req.getRemoteAddr())
|
||||||
|
.build("request/time", requestTime)
|
||||||
|
);
|
||||||
|
|
||||||
|
requestLogger.log(
|
||||||
|
new RequestLogLine(
|
||||||
|
new DateTime(),
|
||||||
|
req.getRemoteAddr(),
|
||||||
|
theQuery,
|
||||||
|
new QueryStats(
|
||||||
|
ImmutableMap.<String, Object>of(
|
||||||
|
"request/time", requestTime,
|
||||||
|
"success", true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
contentType
|
contentType
|
||||||
|
|
Loading…
Reference in New Issue