diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java index 1d978c12bfb4..e123b3013f3c 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java @@ -1330,7 +1330,7 @@ private void publishAllSegments(final Set segments) throws IOExcept final DataSourceMSQDestination destination = (DataSourceMSQDestination) task.getQuerySpec().getDestination(); final Set segmentsWithTombstones = new HashSet<>(segments); - int tombstoneSize = 0; + int numTombstones = 0; if (destination.isReplaceTimeChunks()) { final List intervalsToDrop = findIntervalsToDrop(Preconditions.checkNotNull(segments, "segments")); @@ -1345,7 +1345,7 @@ private void publishAllSegments(final Set segments) throws IOExcept destination.getSegmentGranularity() ); segmentsWithTombstones.addAll(tombstones); - tombstoneSize = tombstones.size(); + numTombstones = tombstones.size(); } catch (IllegalStateException e) { throw new MSQException(e, InsertLockPreemptedFault.instance()); @@ -1392,7 +1392,7 @@ private void publishAllSegments(final Set segments) throws IOExcept ); } - task.emitMetric(context.emitter(), "ingest/tombstones/count", tombstoneSize); + task.emitMetric(context.emitter(), "ingest/tombstones/count", numTombstones); // Include tombstones in the reported segments count task.emitMetric(context.emitter(), "ingest/segments/count", segmentsWithTombstones.size()); } diff --git a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/test/MSQTestControllerContext.java b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/test/MSQTestControllerContext.java index 30b9f0c8590e..027d2a913b21 100644 --- a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/test/MSQTestControllerContext.java +++ b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/test/MSQTestControllerContext.java @@ -49,6 +49,7 @@ import org.apache.druid.msq.util.MultiStageQueryContext; import org.apache.druid.query.QueryContext; import org.apache.druid.server.DruidNode; +import org.apache.druid.server.metrics.NoopServiceEmitter; import org.apache.druid.sql.calcite.util.SpecificSegmentsQuerySegmentWalker; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; @@ -83,6 +84,7 @@ public class MSQTestControllerContext implements ControllerContext ); private final Injector injector; private final ObjectMapper mapper; + private final ServiceEmitter emitter = new NoopServiceEmitter(); private Controller controller; private Map report = null; @@ -219,7 +221,7 @@ public void close() @Override public ServiceEmitter emitter() { - return null; + return emitter; } @Override