mirror of https://github.com/apache/druid.git
use emitting logger for query resource
This commit is contained in:
parent
fcc1366712
commit
d1b035a8b9
|
@ -29,8 +29,7 @@ import com.google.common.io.Closeables;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.metamx.common.guava.Sequence;
|
import com.metamx.common.guava.Sequence;
|
||||||
import com.metamx.common.guava.Sequences;
|
import com.metamx.common.guava.Sequences;
|
||||||
import com.metamx.common.logger.Logger;
|
import com.metamx.emitter.EmittingLogger;
|
||||||
import com.metamx.emitter.service.AlertEvent;
|
|
||||||
import com.metamx.emitter.service.ServiceEmitter;
|
import com.metamx.emitter.service.ServiceEmitter;
|
||||||
import com.metamx.emitter.service.ServiceMetricEvent;
|
import com.metamx.emitter.service.ServiceMetricEvent;
|
||||||
import io.druid.guice.annotations.Json;
|
import io.druid.guice.annotations.Json;
|
||||||
|
@ -57,7 +56,7 @@ import java.util.UUID;
|
||||||
@Path("/druid/v2/")
|
@Path("/druid/v2/")
|
||||||
public class QueryResource
|
public class QueryResource
|
||||||
{
|
{
|
||||||
private static final Logger log = new Logger(QueryResource.class);
|
private static final EmittingLogger log = new EmittingLogger(QueryResource.class);
|
||||||
private static final Charset UTF8 = Charset.forName("UTF-8");
|
private static final Charset UTF8 = Charset.forName("UTF-8");
|
||||||
private static final Joiner COMMA_JOIN = Joiner.on(",");
|
private static final Joiner COMMA_JOIN = Joiner.on(",");
|
||||||
|
|
||||||
|
@ -192,16 +191,12 @@ public class QueryResource
|
||||||
log.error(e2, "Unable to log query [%s]!", queryString);
|
log.error(e2, "Unable to log query [%s]!", queryString);
|
||||||
}
|
}
|
||||||
|
|
||||||
emitter.emit(
|
|
||||||
new AlertEvent.Builder().build(
|
log.makeAlert(e, "Exception handling request")
|
||||||
"Exception handling request",
|
.addData("exception", e.toString())
|
||||||
ImmutableMap.<String, Object>builder()
|
.addData("query", queryString)
|
||||||
.put("exception", e.toString())
|
.addData("peer", req.getRemoteAddr())
|
||||||
.put("query", queryString)
|
.emit();
|
||||||
.put("peer", req.getRemoteAddr())
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
resp.flushBuffer();
|
resp.flushBuffer();
|
||||||
|
|
Loading…
Reference in New Issue