mirror of https://github.com/apache/druid.git
fix serialization of request logs
This commit is contained in:
parent
e20aabd7a9
commit
b93c7e1128
|
@ -19,7 +19,10 @@
|
||||||
|
|
||||||
package com.metamx.druid.http;
|
package com.metamx.druid.http;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.metamx.druid.Query;
|
||||||
import com.metamx.emitter.core.Emitter;
|
import com.metamx.emitter.core.Emitter;
|
||||||
import com.metamx.emitter.core.Event;
|
import com.metamx.emitter.core.Event;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
@ -64,30 +67,52 @@ public class EmittingRequestLogger implements RequestLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
// override JsonValue serialization, instead use annotations
|
||||||
|
// to include type information for polymorphic Query objects
|
||||||
|
@JsonValue(value=false)
|
||||||
public Map<String, Object> toMap()
|
public Map<String, Object> toMap()
|
||||||
{
|
{
|
||||||
return ImmutableMap.<String, Object>builder()
|
return ImmutableMap.of();
|
||||||
.put("feed", getFeed())
|
|
||||||
.put("timestamp", request.getTimestamp())
|
|
||||||
.put("service", service)
|
|
||||||
.put("host", host)
|
|
||||||
.put("query", request.getQuery())
|
|
||||||
.put("remoteAddr", request.getRemoteAddr())
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@JsonProperty("feed")
|
||||||
public String getFeed()
|
public String getFeed()
|
||||||
{
|
{
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@JsonProperty("timestamp")
|
||||||
public DateTime getCreatedTime()
|
public DateTime getCreatedTime()
|
||||||
{
|
{
|
||||||
return request.getTimestamp();
|
return request.getTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonProperty("service")
|
||||||
|
public String getService()
|
||||||
|
{
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty("host")
|
||||||
|
public String getHost()
|
||||||
|
{
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty("query")
|
||||||
|
public Query getQuery()
|
||||||
|
{
|
||||||
|
return request.getQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty("remoteAddr")
|
||||||
|
public String getRemoteAddr()
|
||||||
|
{
|
||||||
|
return request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSafeToBuffer()
|
public boolean isSafeToBuffer()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue