Add "includeAllCounters()" to WorkerContext. (#17047)

This removes the need to read it from the query context.
This commit is contained in:
Gian Merlino 2024-09-13 15:47:51 -07:00 committed by GitHub
parent 28ec962a06
commit 99e8f664a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 1 deletions

View File

@ -27,6 +27,7 @@ import org.apache.druid.msq.kernel.FrameContext;
import org.apache.druid.msq.kernel.FrameProcessorFactory;
import org.apache.druid.msq.kernel.QueryDefinition;
import org.apache.druid.msq.kernel.WorkOrder;
import org.apache.druid.msq.util.MultiStageQueryContext;
import org.apache.druid.server.DruidNode;
import java.io.File;
@ -98,4 +99,9 @@ public interface WorkerContext
DruidNode selfNode();
DataServerQueryHandlerFactory dataServerQueryHandlerFactory();
/**
* Whether to include all counters in reports. See {@link MultiStageQueryContext#CTX_INCLUDE_ALL_COUNTERS} for detail.
*/
boolean includeAllCounters();
}

View File

@ -407,7 +407,7 @@ public class WorkerImpl implements Worker
kernel.startReading();
final QueryContext queryContext = task != null ? QueryContext.of(task.getContext()) : QueryContext.empty();
final boolean includeAllCounters = MultiStageQueryContext.getIncludeAllCounters(queryContext);
final boolean includeAllCounters = context.includeAllCounters();
final RunWorkOrder runWorkOrder = new RunWorkOrder(
task.getControllerTaskId(),
workOrder,

View File

@ -312,6 +312,12 @@ public class IndexerWorkerContext implements WorkerContext
return dataServerQueryHandlerFactory;
}
@Override
public boolean includeAllCounters()
{
return includeAllCounters;
}
private synchronized ServiceLocator makeControllerLocator(final String controllerId)
{
if (controllerLocator == null) {

View File

@ -159,6 +159,12 @@ public class MSQTestWorkerContext implements WorkerContext
return injector.getInstance(DataServerQueryHandlerFactory.class);
}
@Override
public boolean includeAllCounters()
{
return true;
}
class FrameContextImpl implements FrameContext
{
private final File tempDir;