mirror of https://github.com/apache/druid.git
Logging emitter to publish query and other metric events as valid json objects (#8359)
* LoggingEmitter: print event as json * use DefaultRequestLogEventBuilderFactory in emitting request logger by default * print context in query metric as json * removed unused jsonMapper from DefaultQueryMetrics * add comment * remove change to DefaultRequestLogEventBuilderFactory.java
This commit is contained in:
parent
44dd5b5f0d
commit
4d87a19547
|
@ -95,28 +95,27 @@ public class LoggingEmitter implements Emitter
|
|||
}
|
||||
}
|
||||
try {
|
||||
final String message = "Event [%s]";
|
||||
switch (level) {
|
||||
case TRACE:
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace(message, jsonMapper.writeValueAsString(event));
|
||||
log.trace(jsonMapper.writeValueAsString(event));
|
||||
}
|
||||
break;
|
||||
case DEBUG:
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(message, jsonMapper.writeValueAsString(event));
|
||||
log.debug(jsonMapper.writeValueAsString(event));
|
||||
}
|
||||
break;
|
||||
case INFO:
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info(message, jsonMapper.writeValueAsString(event));
|
||||
log.info(jsonMapper.writeValueAsString(event));
|
||||
}
|
||||
break;
|
||||
case WARN:
|
||||
log.warn(message, jsonMapper.writeValueAsString(event));
|
||||
log.warn(jsonMapper.writeValueAsString(event));
|
||||
break;
|
||||
case ERROR:
|
||||
log.error(message, jsonMapper.writeValueAsString(event));
|
||||
log.error(jsonMapper.writeValueAsString(event));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ public class ServiceMetricEvent implements Event
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setDimension(String dim, String value)
|
||||
public Builder setDimension(String dim, Object value)
|
||||
{
|
||||
userDims.put(dim, value);
|
||||
return this;
|
||||
|
|
|
@ -19,19 +19,12 @@
|
|||
|
||||
package org.apache.druid.query.movingaverage;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.druid.query.DefaultQueryMetrics;
|
||||
import org.apache.druid.query.DruidMetrics;
|
||||
|
||||
public class DefaultMovingAverageQueryMetrics extends DefaultQueryMetrics<MovingAverageQuery> implements
|
||||
MovingAverageQueryMetrics
|
||||
{
|
||||
|
||||
public DefaultMovingAverageQueryMetrics(ObjectMapper jsonMapper)
|
||||
{
|
||||
super(jsonMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void query(MovingAverageQuery query)
|
||||
{
|
||||
|
|
|
@ -19,19 +19,15 @@
|
|||
|
||||
package org.apache.druid.query.movingaverage;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.Inject;
|
||||
import org.apache.druid.guice.LazySingleton;
|
||||
import org.apache.druid.guice.annotations.Json;
|
||||
import org.apache.druid.jackson.DefaultObjectMapper;
|
||||
|
||||
@LazySingleton
|
||||
public class DefaultMovingAverageQueryMetricsFactory implements MovingAverageQueryMetricsFactory
|
||||
{
|
||||
|
||||
private static final MovingAverageQueryMetricsFactory INSTANCE =
|
||||
new DefaultMovingAverageQueryMetricsFactory(new DefaultObjectMapper());
|
||||
new DefaultMovingAverageQueryMetricsFactory();
|
||||
|
||||
/**
|
||||
* Should be used only in tests, directly or indirectly (via {@link
|
||||
|
@ -43,17 +39,9 @@ public class DefaultMovingAverageQueryMetricsFactory implements MovingAverageQue
|
|||
return INSTANCE;
|
||||
}
|
||||
|
||||
private final ObjectMapper jsonMapper;
|
||||
|
||||
@Inject
|
||||
public DefaultMovingAverageQueryMetricsFactory(@Json ObjectMapper jsonMapper)
|
||||
{
|
||||
this.jsonMapper = jsonMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingAverageQueryMetrics makeMetrics()
|
||||
{
|
||||
return new DefaultMovingAverageQueryMetrics(jsonMapper);
|
||||
return new DefaultMovingAverageQueryMetrics();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,6 @@ import org.apache.druid.query.timeseries.TimeseriesResultValue;
|
|||
import org.apache.druid.segment.DimensionHandlerUtils;
|
||||
import org.apache.druid.segment.IndexIO;
|
||||
import org.apache.druid.segment.QueryableIndex;
|
||||
import org.apache.druid.segment.TestHelper;
|
||||
import org.apache.druid.segment.column.DictionaryEncodedColumn;
|
||||
import org.apache.druid.segment.indexing.DataSchema;
|
||||
import org.apache.druid.segment.indexing.granularity.UniformGranularitySpec;
|
||||
|
@ -2578,7 +2577,7 @@ public class KafkaIndexTaskTest
|
|||
new ScanQueryRunnerFactory(
|
||||
new ScanQueryQueryToolChest(
|
||||
new ScanQueryConfig(),
|
||||
new DefaultGenericQueryMetricsFactory(TestHelper.makeJsonMapper())
|
||||
new DefaultGenericQueryMetricsFactory()
|
||||
),
|
||||
new ScanQueryEngine(),
|
||||
new ScanQueryConfig()
|
||||
|
|
|
@ -19,18 +19,14 @@
|
|||
|
||||
package org.apache.druid.query;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.Inject;
|
||||
import org.apache.druid.guice.LazySingleton;
|
||||
import org.apache.druid.guice.annotations.Json;
|
||||
import org.apache.druid.jackson.DefaultObjectMapper;
|
||||
|
||||
@LazySingleton
|
||||
public class DefaultGenericQueryMetricsFactory implements GenericQueryMetricsFactory
|
||||
{
|
||||
private static final GenericQueryMetricsFactory INSTANCE =
|
||||
new DefaultGenericQueryMetricsFactory(new DefaultObjectMapper());
|
||||
new DefaultGenericQueryMetricsFactory();
|
||||
|
||||
/**
|
||||
* Should be used only in tests, directly or indirectly (e. g. in {@link
|
||||
|
@ -42,18 +38,10 @@ public class DefaultGenericQueryMetricsFactory implements GenericQueryMetricsFac
|
|||
return INSTANCE;
|
||||
}
|
||||
|
||||
private final ObjectMapper jsonMapper;
|
||||
|
||||
@Inject
|
||||
public DefaultGenericQueryMetricsFactory(@Json ObjectMapper jsonMapper)
|
||||
{
|
||||
this.jsonMapper = jsonMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryMetrics<Query<?>> makeMetrics(Query<?> query)
|
||||
{
|
||||
DefaultQueryMetrics<Query<?>> queryMetrics = new DefaultQueryMetrics<>(jsonMapper);
|
||||
DefaultQueryMetrics<Query<?>> queryMetrics = new DefaultQueryMetrics<>();
|
||||
queryMetrics.query(query);
|
||||
return queryMetrics;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package org.apache.druid.query;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.druid.collections.bitmap.BitmapFactory;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
|
@ -41,18 +39,12 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
public class DefaultQueryMetrics<QueryType extends Query<?>> implements QueryMetrics<QueryType>
|
||||
{
|
||||
protected final ObjectMapper jsonMapper;
|
||||
protected final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder();
|
||||
protected final Map<String, Number> metrics = new HashMap<>();
|
||||
|
||||
/** Non final to give subclasses ability to reassign it. */
|
||||
protected Thread ownerThread = Thread.currentThread();
|
||||
|
||||
public DefaultQueryMetrics(ObjectMapper jsonMapper)
|
||||
{
|
||||
this.jsonMapper = jsonMapper;
|
||||
}
|
||||
|
||||
protected void checkModifiedFromOwnerThread()
|
||||
{
|
||||
if (Thread.currentThread() != ownerThread) {
|
||||
|
@ -64,7 +56,7 @@ public class DefaultQueryMetrics<QueryType extends Query<?>> implements QueryMet
|
|||
}
|
||||
}
|
||||
|
||||
protected void setDimension(String dimension, String value)
|
||||
protected void setDimension(String dimension, Object value)
|
||||
{
|
||||
checkModifiedFromOwnerThread();
|
||||
builder.setDimension(dimension, value);
|
||||
|
@ -131,15 +123,7 @@ public class DefaultQueryMetrics<QueryType extends Query<?>> implements QueryMet
|
|||
@Override
|
||||
public void context(QueryType query)
|
||||
{
|
||||
try {
|
||||
setDimension(
|
||||
"context",
|
||||
jsonMapper.writeValueAsString(query.getContext() == null ? ImmutableMap.of() : query.getContext())
|
||||
);
|
||||
}
|
||||
catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
setDimension("context", query.getContext() == null ? ImmutableMap.of() : query.getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,18 +19,11 @@
|
|||
|
||||
package org.apache.druid.query.groupby;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.druid.query.DefaultQueryMetrics;
|
||||
import org.apache.druid.query.DruidMetrics;
|
||||
|
||||
public class DefaultGroupByQueryMetrics extends DefaultQueryMetrics<GroupByQuery> implements GroupByQueryMetrics
|
||||
{
|
||||
|
||||
public DefaultGroupByQueryMetrics(ObjectMapper jsonMapper)
|
||||
{
|
||||
super(jsonMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void query(GroupByQuery query)
|
||||
{
|
||||
|
|
|
@ -19,18 +19,14 @@
|
|||
|
||||
package org.apache.druid.query.groupby;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.Inject;
|
||||
import org.apache.druid.guice.LazySingleton;
|
||||
import org.apache.druid.guice.annotations.Json;
|
||||
import org.apache.druid.jackson.DefaultObjectMapper;
|
||||
|
||||
@LazySingleton
|
||||
public class DefaultGroupByQueryMetricsFactory implements GroupByQueryMetricsFactory
|
||||
{
|
||||
private static final GroupByQueryMetricsFactory INSTANCE =
|
||||
new DefaultGroupByQueryMetricsFactory(new DefaultObjectMapper());
|
||||
new DefaultGroupByQueryMetricsFactory();
|
||||
|
||||
/**
|
||||
* Should be used only in tests, directly or indirectly (via {@link
|
||||
|
@ -42,17 +38,9 @@ public class DefaultGroupByQueryMetricsFactory implements GroupByQueryMetricsFac
|
|||
return INSTANCE;
|
||||
}
|
||||
|
||||
private final ObjectMapper jsonMapper;
|
||||
|
||||
@Inject
|
||||
public DefaultGroupByQueryMetricsFactory(@Json ObjectMapper jsonMapper)
|
||||
{
|
||||
this.jsonMapper = jsonMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupByQueryMetrics makeMetrics()
|
||||
{
|
||||
return new DefaultGroupByQueryMetrics(jsonMapper);
|
||||
return new DefaultGroupByQueryMetrics();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,18 +19,12 @@
|
|||
|
||||
package org.apache.druid.query.timeseries;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.druid.query.DefaultQueryMetrics;
|
||||
import org.apache.druid.query.DruidMetrics;
|
||||
|
||||
public class DefaultTimeseriesQueryMetrics extends DefaultQueryMetrics<TimeseriesQuery>
|
||||
implements TimeseriesQueryMetrics
|
||||
{
|
||||
public DefaultTimeseriesQueryMetrics(ObjectMapper jsonMapper)
|
||||
{
|
||||
super(jsonMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void query(TimeseriesQuery query)
|
||||
{
|
||||
|
|
|
@ -19,18 +19,14 @@
|
|||
|
||||
package org.apache.druid.query.timeseries;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.Inject;
|
||||
import org.apache.druid.guice.LazySingleton;
|
||||
import org.apache.druid.guice.annotations.Json;
|
||||
import org.apache.druid.jackson.DefaultObjectMapper;
|
||||
|
||||
@LazySingleton
|
||||
public class DefaultTimeseriesQueryMetricsFactory implements TimeseriesQueryMetricsFactory
|
||||
{
|
||||
private static final TimeseriesQueryMetricsFactory INSTANCE =
|
||||
new DefaultTimeseriesQueryMetricsFactory(new DefaultObjectMapper());
|
||||
new DefaultTimeseriesQueryMetricsFactory();
|
||||
|
||||
/**
|
||||
* Should be used only in tests, directly or indirectly (via {@link
|
||||
|
@ -42,17 +38,9 @@ public class DefaultTimeseriesQueryMetricsFactory implements TimeseriesQueryMetr
|
|||
return INSTANCE;
|
||||
}
|
||||
|
||||
private final ObjectMapper jsonMapper;
|
||||
|
||||
@Inject
|
||||
public DefaultTimeseriesQueryMetricsFactory(@Json ObjectMapper jsonMapper)
|
||||
{
|
||||
this.jsonMapper = jsonMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimeseriesQueryMetrics makeMetrics()
|
||||
{
|
||||
return new DefaultTimeseriesQueryMetrics(jsonMapper);
|
||||
return new DefaultTimeseriesQueryMetrics();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.apache.druid.query.topn;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.druid.query.DefaultQueryMetrics;
|
||||
import org.apache.druid.query.DruidMetrics;
|
||||
import org.apache.druid.segment.ColumnValueSelector;
|
||||
|
@ -27,12 +26,6 @@ import org.apache.druid.segment.Cursor;
|
|||
|
||||
public class DefaultTopNQueryMetrics extends DefaultQueryMetrics<TopNQuery> implements TopNQueryMetrics
|
||||
{
|
||||
|
||||
public DefaultTopNQueryMetrics(ObjectMapper jsonMapper)
|
||||
{
|
||||
super(jsonMapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void query(TopNQuery query)
|
||||
{
|
||||
|
|
|
@ -19,17 +19,13 @@
|
|||
|
||||
package org.apache.druid.query.topn;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.Inject;
|
||||
import org.apache.druid.guice.LazySingleton;
|
||||
import org.apache.druid.guice.annotations.Json;
|
||||
import org.apache.druid.jackson.DefaultObjectMapper;
|
||||
|
||||
@LazySingleton
|
||||
public class DefaultTopNQueryMetricsFactory implements TopNQueryMetricsFactory
|
||||
{
|
||||
private static final TopNQueryMetricsFactory INSTANCE = new DefaultTopNQueryMetricsFactory(new DefaultObjectMapper());
|
||||
private static final TopNQueryMetricsFactory INSTANCE = new DefaultTopNQueryMetricsFactory();
|
||||
|
||||
/**
|
||||
* Should be used only in tests, directly or indirectly (via {@link TopNQueryQueryToolChest#TopNQueryQueryToolChest}).
|
||||
|
@ -40,17 +36,9 @@ public class DefaultTopNQueryMetricsFactory implements TopNQueryMetricsFactory
|
|||
return INSTANCE;
|
||||
}
|
||||
|
||||
private final ObjectMapper jsonMapper;
|
||||
|
||||
@Inject
|
||||
public DefaultTopNQueryMetricsFactory(@Json ObjectMapper jsonMapper)
|
||||
{
|
||||
this.jsonMapper = jsonMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TopNQueryMetrics makeMetrics()
|
||||
{
|
||||
return new DefaultTopNQueryMetrics(jsonMapper);
|
||||
return new DefaultTopNQueryMetrics();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.apache.druid.query.dimension.ListFilteredDimensionSpec;
|
|||
import org.apache.druid.query.filter.SelectorDimFilter;
|
||||
import org.apache.druid.query.topn.TopNQuery;
|
||||
import org.apache.druid.query.topn.TopNQueryBuilder;
|
||||
import org.apache.druid.segment.TestHelper;
|
||||
import org.joda.time.Interval;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@ -49,7 +48,7 @@ public class DefaultQueryMetricsTest
|
|||
{
|
||||
CachingEmitter cachingEmitter = new CachingEmitter();
|
||||
ServiceEmitter serviceEmitter = new ServiceEmitter("", "", cachingEmitter);
|
||||
DefaultQueryMetrics<Query<?>> queryMetrics = new DefaultQueryMetrics<>(TestHelper.makeJsonMapper());
|
||||
DefaultQueryMetrics<Query<?>> queryMetrics = new DefaultQueryMetrics<>();
|
||||
TopNQuery query = new TopNQueryBuilder()
|
||||
.dataSource("xx")
|
||||
.granularity(Granularities.ALL)
|
||||
|
@ -90,7 +89,7 @@ public class DefaultQueryMetricsTest
|
|||
{
|
||||
CachingEmitter cachingEmitter = new CachingEmitter();
|
||||
ServiceEmitter serviceEmitter = new ServiceEmitter("", "", cachingEmitter);
|
||||
DefaultQueryMetrics<Query<?>> queryMetrics = new DefaultQueryMetrics<>(TestHelper.makeJsonMapper());
|
||||
DefaultQueryMetrics<Query<?>> queryMetrics = new DefaultQueryMetrics<>();
|
||||
testQueryMetricsDefaultMetricNamesAndUnits(cachingEmitter, serviceEmitter, queryMetrics);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.druid.query.dimension.ExtractionDimensionSpec;
|
|||
import org.apache.druid.query.extraction.MapLookupExtractor;
|
||||
import org.apache.druid.query.filter.SelectorDimFilter;
|
||||
import org.apache.druid.query.lookup.LookupExtractionFn;
|
||||
import org.apache.druid.segment.TestHelper;
|
||||
import org.joda.time.Interval;
|
||||
import org.joda.time.Period;
|
||||
import org.junit.Assert;
|
||||
|
@ -53,7 +52,7 @@ public class DefaultGroupByQueryMetricsTest
|
|||
{
|
||||
CachingEmitter cachingEmitter = new CachingEmitter();
|
||||
ServiceEmitter serviceEmitter = new ServiceEmitter("", "", cachingEmitter);
|
||||
DefaultGroupByQueryMetrics queryMetrics = new DefaultGroupByQueryMetrics(TestHelper.makeJsonMapper());
|
||||
DefaultGroupByQueryMetrics queryMetrics = new DefaultGroupByQueryMetrics();
|
||||
GroupByQuery.Builder builder = GroupByQuery
|
||||
.builder()
|
||||
.setDataSource(QueryRunnerTestHelper.DATA_SOURCE)
|
||||
|
@ -104,7 +103,7 @@ public class DefaultGroupByQueryMetricsTest
|
|||
{
|
||||
CachingEmitter cachingEmitter = new CachingEmitter();
|
||||
ServiceEmitter serviceEmitter = new ServiceEmitter("", "", cachingEmitter);
|
||||
DefaultGroupByQueryMetrics queryMetrics = new DefaultGroupByQueryMetrics(TestHelper.makeJsonMapper());
|
||||
DefaultGroupByQueryMetrics queryMetrics = new DefaultGroupByQueryMetrics();
|
||||
DefaultQueryMetricsTest.testQueryMetricsDefaultMetricNamesAndUnits(cachingEmitter, serviceEmitter, queryMetrics);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.druid.query.DefaultQueryMetricsTest;
|
|||
import org.apache.druid.query.DruidMetrics;
|
||||
import org.apache.druid.query.Druids;
|
||||
import org.apache.druid.query.QueryRunnerTestHelper;
|
||||
import org.apache.druid.segment.TestHelper;
|
||||
import org.joda.time.Interval;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@ -46,7 +45,7 @@ public class DefaultTimeseriesQueryMetricsTest
|
|||
{
|
||||
CachingEmitter cachingEmitter = new CachingEmitter();
|
||||
ServiceEmitter serviceEmitter = new ServiceEmitter("", "", cachingEmitter);
|
||||
DefaultTimeseriesQueryMetrics queryMetrics = new DefaultTimeseriesQueryMetrics(TestHelper.makeJsonMapper());
|
||||
DefaultTimeseriesQueryMetrics queryMetrics = new DefaultTimeseriesQueryMetrics();
|
||||
TimeseriesQuery query = Druids
|
||||
.newTimeseriesQueryBuilder()
|
||||
.dataSource(QueryRunnerTestHelper.DATA_SOURCE)
|
||||
|
@ -89,7 +88,7 @@ public class DefaultTimeseriesQueryMetricsTest
|
|||
{
|
||||
CachingEmitter cachingEmitter = new CachingEmitter();
|
||||
ServiceEmitter serviceEmitter = new ServiceEmitter("", "", cachingEmitter);
|
||||
DefaultTimeseriesQueryMetrics queryMetrics = new DefaultTimeseriesQueryMetrics(TestHelper.makeJsonMapper());
|
||||
DefaultTimeseriesQueryMetrics queryMetrics = new DefaultTimeseriesQueryMetrics();
|
||||
DefaultQueryMetricsTest.testQueryMetricsDefaultMetricNamesAndUnits(cachingEmitter, serviceEmitter, queryMetrics);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.apache.druid.query.aggregation.CountAggregatorFactory;
|
|||
import org.apache.druid.query.dimension.DefaultDimensionSpec;
|
||||
import org.apache.druid.query.dimension.ListFilteredDimensionSpec;
|
||||
import org.apache.druid.query.filter.SelectorDimFilter;
|
||||
import org.apache.druid.segment.TestHelper;
|
||||
import org.joda.time.Interval;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@ -51,7 +50,7 @@ public class DefaultTopNQueryMetricsTest
|
|||
{
|
||||
CachingEmitter cachingEmitter = new CachingEmitter();
|
||||
ServiceEmitter serviceEmitter = new ServiceEmitter("", "", cachingEmitter);
|
||||
DefaultTopNQueryMetrics queryMetrics = new DefaultTopNQueryMetrics(TestHelper.makeJsonMapper());
|
||||
DefaultTopNQueryMetrics queryMetrics = new DefaultTopNQueryMetrics();
|
||||
TopNQuery query = new TopNQueryBuilder()
|
||||
.dataSource("xx")
|
||||
.granularity(Granularities.ALL)
|
||||
|
@ -101,7 +100,7 @@ public class DefaultTopNQueryMetricsTest
|
|||
{
|
||||
CachingEmitter cachingEmitter = new CachingEmitter();
|
||||
ServiceEmitter serviceEmitter = new ServiceEmitter("", "", cachingEmitter);
|
||||
DefaultTopNQueryMetrics queryMetrics = new DefaultTopNQueryMetrics(TestHelper.makeJsonMapper());
|
||||
DefaultTopNQueryMetrics queryMetrics = new DefaultTopNQueryMetrics();
|
||||
DefaultQueryMetricsTest.testQueryMetricsDefaultMetricNamesAndUnits(cachingEmitter, serviceEmitter, queryMetrics);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class EmittingRequestLoggerProvider implements RequestLoggerProvider
|
|||
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
private RequestLogEventBuilderFactory requestLogEventBuilderFactory = null;
|
||||
private RequestLogEventBuilderFactory requestLogEventBuilderFactory = DefaultRequestLogEventBuilderFactory.instance();
|
||||
|
||||
@JacksonInject
|
||||
@NotNull
|
||||
|
|
|
@ -54,7 +54,6 @@ import org.apache.druid.query.timeseries.TimeseriesQueryRunnerFactory;
|
|||
import org.apache.druid.segment.IndexIO;
|
||||
import org.apache.druid.segment.IndexMerger;
|
||||
import org.apache.druid.segment.IndexMergerV9;
|
||||
import org.apache.druid.segment.TestHelper;
|
||||
import org.apache.druid.segment.column.ColumnConfig;
|
||||
import org.apache.druid.segment.indexing.DataSchema;
|
||||
import org.apache.druid.segment.indexing.RealtimeTuningConfig;
|
||||
|
@ -253,7 +252,7 @@ public class AppenderatorTester implements AutoCloseable
|
|||
ScanQuery.class, new ScanQueryRunnerFactory(
|
||||
new ScanQueryQueryToolChest(
|
||||
new ScanQueryConfig(),
|
||||
new DefaultGenericQueryMetricsFactory(TestHelper.makeJsonMapper())
|
||||
new DefaultGenericQueryMetricsFactory()
|
||||
),
|
||||
new ScanQueryEngine(),
|
||||
new ScanQueryConfig()
|
||||
|
|
|
@ -255,7 +255,7 @@ public class AsyncQueryForwardingServletTest extends BaseJettyTest
|
|||
null,
|
||||
new NoopServiceEmitter(),
|
||||
new NoopRequestLogger(),
|
||||
new DefaultGenericQueryMetricsFactory(jsonMapper),
|
||||
new DefaultGenericQueryMetricsFactory(),
|
||||
new AuthenticatorMapper(ImmutableMap.of())
|
||||
)
|
||||
{
|
||||
|
@ -347,7 +347,7 @@ public class AsyncQueryForwardingServletTest extends BaseJettyTest
|
|||
injector.getInstance(DruidHttpClientConfig.class),
|
||||
new NoopServiceEmitter(),
|
||||
new NoopRequestLogger(),
|
||||
new DefaultGenericQueryMetricsFactory(jsonMapper),
|
||||
new DefaultGenericQueryMetricsFactory(),
|
||||
new AuthenticatorMapper(ImmutableMap.of())
|
||||
)
|
||||
{
|
||||
|
|
|
@ -131,7 +131,7 @@ public class QueryResourceTest
|
|||
new QueryLifecycleFactory(
|
||||
WAREHOUSE,
|
||||
TEST_SEGMENT_WALKER,
|
||||
new DefaultGenericQueryMetricsFactory(JSON_MAPPER),
|
||||
new DefaultGenericQueryMetricsFactory(),
|
||||
new NoopServiceEmitter(),
|
||||
testRequestLogger,
|
||||
new AuthConfig(),
|
||||
|
@ -142,7 +142,7 @@ public class QueryResourceTest
|
|||
queryManager,
|
||||
new AuthConfig(),
|
||||
null,
|
||||
new DefaultGenericQueryMetricsFactory(JSON_MAPPER)
|
||||
new DefaultGenericQueryMetricsFactory()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ public class QueryResourceTest
|
|||
new QueryLifecycleFactory(
|
||||
WAREHOUSE,
|
||||
TEST_SEGMENT_WALKER,
|
||||
new DefaultGenericQueryMetricsFactory(JSON_MAPPER),
|
||||
new DefaultGenericQueryMetricsFactory(),
|
||||
new NoopServiceEmitter(),
|
||||
testRequestLogger,
|
||||
new AuthConfig(),
|
||||
|
@ -364,7 +364,7 @@ public class QueryResourceTest
|
|||
queryManager,
|
||||
new AuthConfig(),
|
||||
authMapper,
|
||||
new DefaultGenericQueryMetricsFactory(JSON_MAPPER)
|
||||
new DefaultGenericQueryMetricsFactory()
|
||||
);
|
||||
|
||||
|
||||
|
@ -467,7 +467,7 @@ public class QueryResourceTest
|
|||
new QueryLifecycleFactory(
|
||||
WAREHOUSE,
|
||||
TEST_SEGMENT_WALKER,
|
||||
new DefaultGenericQueryMetricsFactory(JSON_MAPPER),
|
||||
new DefaultGenericQueryMetricsFactory(),
|
||||
new NoopServiceEmitter(),
|
||||
testRequestLogger,
|
||||
new AuthConfig(),
|
||||
|
@ -478,7 +478,7 @@ public class QueryResourceTest
|
|||
queryManager,
|
||||
new AuthConfig(),
|
||||
authMapper,
|
||||
new DefaultGenericQueryMetricsFactory(JSON_MAPPER)
|
||||
new DefaultGenericQueryMetricsFactory()
|
||||
);
|
||||
|
||||
final String queryString = "{\"queryType\":\"timeBoundary\", \"dataSource\":\"allow\","
|
||||
|
@ -589,7 +589,7 @@ public class QueryResourceTest
|
|||
new QueryLifecycleFactory(
|
||||
WAREHOUSE,
|
||||
TEST_SEGMENT_WALKER,
|
||||
new DefaultGenericQueryMetricsFactory(JSON_MAPPER),
|
||||
new DefaultGenericQueryMetricsFactory(),
|
||||
new NoopServiceEmitter(),
|
||||
testRequestLogger,
|
||||
new AuthConfig(),
|
||||
|
@ -600,7 +600,7 @@ public class QueryResourceTest
|
|||
queryManager,
|
||||
new AuthConfig(),
|
||||
authMapper,
|
||||
new DefaultGenericQueryMetricsFactory(JSON_MAPPER)
|
||||
new DefaultGenericQueryMetricsFactory()
|
||||
);
|
||||
|
||||
final String queryString = "{\"queryType\":\"timeBoundary\", \"dataSource\":\"allow\","
|
||||
|
|
|
@ -579,7 +579,7 @@ public class ServerManagerTest
|
|||
@Override
|
||||
public QueryMetrics<Query<?>> makeMetrics(QueryType query)
|
||||
{
|
||||
return new DefaultQueryMetrics<>(new DefaultObjectMapper());
|
||||
return new DefaultQueryMetrics<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -531,7 +531,7 @@ public class CalciteTests
|
|||
new ScanQueryRunnerFactory(
|
||||
new ScanQueryQueryToolChest(
|
||||
new ScanQueryConfig(),
|
||||
new DefaultGenericQueryMetricsFactory(TestHelper.makeJsonMapper())
|
||||
new DefaultGenericQueryMetricsFactory()
|
||||
),
|
||||
new ScanQueryEngine(),
|
||||
new ScanQueryConfig()
|
||||
|
@ -588,7 +588,7 @@ public class CalciteTests
|
|||
}
|
||||
},
|
||||
walker,
|
||||
new DefaultGenericQueryMetricsFactory(INJECTOR.getInstance(Key.get(ObjectMapper.class, Json.class))),
|
||||
new DefaultGenericQueryMetricsFactory(),
|
||||
new ServiceEmitter("dummy", "dummy", new NoopEmitter()),
|
||||
new NoopRequestLogger(),
|
||||
new AuthConfig(),
|
||||
|
|
Loading…
Reference in New Issue