You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "uds5501 (via GitHub)" <gi...@apache.org> on 2025/07/30 07:16:44 UTC

[PR] Making task log storage optional for Kubernetes Runner (druid)

uds5501 opened a new pull request, #18341:
URL: https://github.com/apache/druid/pull/18341

   ### Description
   
   The approach in general is this:
   - I am using existing `FileTaskLogsConfig` class bound to 'druid.indexer.logs' that have druid.indexer.logs.storeTaskLogs option to determine whether to push the logs to deep storage or not.
   - Other runners can contact overlord at point of construction to verify whether to push the logs or not. [in future PR]
   - This same config option can be used by `/task/{taskId}/logs` endpoint to return a message like “Log storage for completed tasks have been disabled, please check your configuration”.
   
   Other ideas:
   - Reusing the `noop` TaskLog type to not push any logs at all.
       - This would've worked fine if all task logs were being pushed from overlord. Unfortunately, indexer / MM themselves have separate configs for these so coordinating it altogether will be messy.
       - We still need reports and `task.json` to be pushed, using a `noop` type will break this.
   
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `KubernetesPeonLifecycle`
   
   TODO: adding an embedded test to verify the same locally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2264469753


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -20,32 +20,94 @@
 package org.apache.druid.guice;
 
 import com.google.inject.Binder;
+import com.google.inject.Inject;
 import com.google.inject.Key;
 import com.google.inject.Module;
 import com.google.inject.multibindings.MapBinder;
+import com.google.inject.name.Names;
 import org.apache.druid.indexing.common.config.FileTaskLogsConfig;
 import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
 import org.apache.druid.tasklogs.NoopTaskLogs;
 import org.apache.druid.tasklogs.TaskLogKiller;
 import org.apache.druid.tasklogs.TaskLogPusher;
 import org.apache.druid.tasklogs.TaskLogs;
 import org.apache.druid.tasklogs.TaskPayloadManager;
 
+import java.util.Properties;
+
 /**
+ *
  */
 public class IndexingServiceTaskLogsModule implements Module
 {
+  private Properties props;
+
+  @Inject
+  public IndexingServiceTaskLogsModule(Properties props)

Review Comment:
   This didn't workout. It seems that `configure()` happens first and then the `@inject` is triggered for Modules.
   Keeping it as is for the time being.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2262313778


##########
services/src/main/java/org/apache/druid/cli/CliOverlord.java:
##########
@@ -464,6 +455,38 @@ private void configureOverlordHelpers(Binder binder)
     );
   }
 
+  private void bindTaskLogStreamer(Binder binder)
+  {
+    String logsType = properties.getProperty("druid.indexer.logs.type");
+    if ("switching".equals(logsType)) {
+      bindSwitchingTaskLogs(binder);

Review Comment:
   This has been removed now.



##########
services/src/main/java/org/apache/druid/cli/CliOverlord.java:
##########
@@ -464,6 +455,38 @@ private void configureOverlordHelpers(Binder binder)
     );
   }
 
+  private void bindTaskLogStreamer(Binder binder)
+  {
+    String logsType = properties.getProperty("druid.indexer.logs.type");
+    if ("switching".equals(logsType)) {
+      bindSwitchingTaskLogs(binder);
+    } else {
+      bindSwitchingTaskLogStreamer(binder);
+    }
+  }
+
+  private static void bindSwitchingTaskLogStreamer(Binder binder)

Review Comment:
   nuked



##########
services/src/main/java/org/apache/druid/cli/CliOverlord.java:
##########
@@ -464,6 +455,38 @@ private void configureOverlordHelpers(Binder binder)
     );
   }
 
+  private void bindTaskLogStreamer(Binder binder)
+  {
+    String logsType = properties.getProperty("druid.indexer.logs.type");
+    if ("switching".equals(logsType)) {
+      bindSwitchingTaskLogs(binder);
+    } else {
+      bindSwitchingTaskLogStreamer(binder);
+    }
+  }
+
+  private static void bindSwitchingTaskLogStreamer(Binder binder)
+  {
+    binder.bind(TaskLogStreamer.class)
+          .to(SwitchingTaskLogStreamer.class)
+          .in(LazySingleton.class);
+    binder.bind(new TypeLiteral<List<TaskLogStreamer>>() {})
+          .toProvider(new ListProvider<TaskLogStreamer>().add(TaskLogs.class))
+          .in(LazySingleton.class);
+
+    binder.bind(TaskLogStreamer.class)
+          .annotatedWith(Names.named("taskstreamer"))
+          .to(TaskRunnerTaskLogStreamer.class)
+          .in(LazySingleton.class);
+  }
+
+  private static void bindSwitchingTaskLogs(Binder binder)

Review Comment:
   nuked



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259272141


##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -81,12 +85,16 @@
 public class KubernetesOverlordModule implements DruidModule
 {
 
-  private static final Logger log = new Logger(KubernetesOverlordModule.class);
+  private static final Logger log = new EmittingLogger(KubernetesOverlordModule.class);
   private static final String K8SANDWORKER_PROPERTIES_PREFIX = IndexingServiceModuleHelper.INDEXER_RUNNER_PROPERTY_PREFIX
                                                                + ".k8sAndWorker";
   private static final String RUNNERSTRATEGY_PROPERTIES_FORMAT_STRING = K8SANDWORKER_PROPERTIES_PREFIX
                                                                         + ".runnerStrategy.%s";
   private static final String HTTPCLIENT_PROPERITES_PREFIX = K8SANDWORKER_PROPERTIES_PREFIX + ".http";
+  private static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  private static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";
+  private static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".streamType";
+  private static final String PROPERTY_KEY_SWITCHING_REPORTS_TYPE = PROPERTY_PREFIX_SWITCHING + ".reportsType";

Review Comment:
   Yeah, they should be in the `SwitchingTaskLogs` class because they are related to that impl only.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2262096571


##########
processing/src/main/java/org/apache/druid/guice/Binders.java:
##########
@@ -59,4 +60,11 @@ public static MapBinder<String, TaskLogs> taskLogsBinder(Binder binder)
   {
     return PolyBind.optionBinder(binder, Key.get(TaskLogs.class));
   }
+
+  public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz)
+  {
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class)).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("defaultType"))).addBinding(type).to(clazz);
+    binder.bind(Key.get(TaskLogs.class, Names.named(type))).to(clazz);

Review Comment:
   Removed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2245657132


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   Hmm, I see, will use this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259195066


##########
processing/src/main/java/org/apache/druid/tasklogs/TaskLogPusher.java:
##########
@@ -39,4 +39,9 @@ default void pushTaskReports(String taskid, File reportFile) throws IOException
   default void pushTaskStatus(String taskid, File reportFile) throws IOException
   {
   }
+
+  default boolean logPushEnabled()

Review Comment:
   The `TaskLogPusher`  has varied responsibilities internally (reports, logs, statuses etc). This boolean helps in the scenario of K8S runners where it creates a temp file before pushing the logs to deep storage. This method helps skip the entire step



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259196965


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/config/FileTaskLogsConfig.java:
##########
@@ -19,11 +19,13 @@
 
 package org.apache.druid.indexing.common.config;
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 import javax.validation.constraints.NotNull;
 import java.io.File;
 
+@JsonIgnoreProperties(ignoreUnknown = true)

Review Comment:
   Yeah, in unit tests for the modules it seemed to be failing when I configured `switch` types.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2250356771


##########
indexing-service/src/test/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogsTest.java:
##########
@@ -0,0 +1,332 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.common.io.ByteStreams;
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class SwitchingTaskLogsTest
+{
+  private static final String TASK_ID = "testTask";
+  private static final String LOG_CONTENT = "test log content";
+  private static final String REPORT_CONTENT = "test report content";
+  private static final String STATUS_CONTENT = "test status content";
+  private static final String PAYLOAD_CONTENT = "test payload content";
+  private static final long OFFSET = 100L;
+  private static final long TIMESTAMP = 1234567890L;
+
+  @Mock
+  private TaskLogs delegateTaskLogs;
+
+  @Mock
+  private TaskLogs streamerTaskLogs;
+
+  @Mock
+  private TaskLogs pusherTaskLogs;
+
+  @Mock
+  private File testFile;
+
+  private SwitchingTaskLogs taskLogs;
+
+  @Before
+  public void setUp()
+  {
+    MockitoAnnotations.initMocks(this);

Review Comment:
   Will update the tests to reflect this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on PR #18341:
URL: https://github.com/apache/druid/pull/18341#issuecomment-3149818721

   Tested locally, the logs streaming is done via s3 as expected, the log pushes + temporary log savings have been shut down (noop). 
   
   Task status - 
   ```
   {
     "id": "index_parallel_kttm1_mbhlngbb_2025-08-04T09:26:54.347Z",
     "groupId": "index_parallel_kttm1_mbhlngbb_2025-08-04T09:26:54.347Z",
     "type": "index_parallel",
     "createdTime": "2025-08-04T09:26:54.359Z",
     "queueInsertionTime": "1970-01-01T00:00:00.000Z",
     "statusCode": "SUCCESS",
     "status": "SUCCESS",
     "runnerStatusCode": "WAITING",
     "duration": 51000,
     "location": {
       "host": "10.244.0.153",
       "port": 8100,
       "tlsPort": -1,
       "k8sPodName": "indexparallelkttm1mbhlngbb2025-d8c190f944e0b8893f24ce3edfdb7q9r"
     },
     "dataSource": "kttm1",
     "errorMsg": null
   }
   ```
   
   report - 
   
   ```
   {
     "ingestionState": "COMPLETED",
     "unparseableEvents": {},
     "rowStats": {
       "determinePartitions": {
         "processed": 465346,
         "processedBytes": 360464067,
         "processedWithError": 0,
         "thrownAway": 0,
         "unparseable": 0
       },
       "buildSegments": {
         "processed": 465346,
         "processedBytes": 360464067,
         "processedWithError": 0,
         "thrownAway": 0,
         "unparseable": 0
       }
     },
     "errorMsg": null,
     "segmentAvailabilityConfirmed": false,
     "segmentAvailabilityWaitTimeMs": 0,
     "recordsProcessed": {},
     "segmentsPublished": 1
   }
   ```
   
   <img width="954" height="68" alt="image" src="https://github.com/user-attachments/assets/574e26bf-5237-4755-b30b-c457f4962063" />
   
   
   <img width="1246" height="322" alt="image" src="https://github.com/user-attachments/assets/614c4339-3af3-43cc-88ed-10f4fa5a6100" />
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259252988


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+  private final TaskLogs reportTaskLogs;
+  private final TaskLogs logStreamer;
+  private final TaskLogs logPusher;
+
+  @Inject
+  public SwitchingTaskLogs(
+      @Named("reports") TaskLogs reportTaskLogs,

Review Comment:
   Got it, I'll take care of those handlings internally itself.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2244481280


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   It can be a little confusing to have say these props set on the Overlord:
   ```properties
   druid.indexer.logs.type=external
   druid.indexer.logs.delegate.type=file
   ```
   
   It is unclear why we need a delegate if we just wanted `FileTaskLogs`.
   
   I think the intention is to direct task reports, status and payload to one place and logs to another.
   So we need some kind of `switching` or `composite` task logs type, which would give us these props:
   ```properties
   druid.indexer.logs.type=switching
   druid.indexer.logs.switching.reportsType=file
   druid.indexer.logs.switching.logsType=hdfs
   ```
   
   With this, we just need a `SwitchingTaskLogs` implementation which takes in a `reportsType` and a `logsType`, both of which would be `TaskLogs` implementations.
   
   



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/ExternalLogStreamer.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import org.apache.druid.tasklogs.TaskLogStreamer;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ExternalLogStreamer implements TaskLogStreamer

Review Comment:
   This might not be needed if we go the `switching` route.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/ExternalTaskLogs.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.java.util.emitter.EmittingLogger;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ExternalTaskLogs implements TaskLogs
+{
+  private static final EmittingLogger log = new EmittingLogger(ExternalTaskLogs.class);
+  private final TaskLogs delegate;
+  private final ExternalLogStreamer logStreamer;
+
+  @Inject
+  public ExternalTaskLogs(@Named("delegate") TaskLogs delegate, ExternalLogStreamer logStreamer)
+  {
+    this.delegate = delegate;
+    this.logStreamer = logStreamer;
+  }
+
+  @Override
+  public Optional<InputStream> streamTaskLog(String taskid, long offset) throws IOException
+  {
+    return logStreamer.streamTaskLog(taskid, offset);
+  }
+
+  @Override
+  public Optional<InputStream> streamTaskReports(final String taskid) throws IOException
+  {
+    return delegate.streamTaskReports(taskid);
+  }
+
+  @Override
+  public Optional<InputStream> streamTaskStatus(final String taskid) throws IOException
+  {
+    return delegate.streamTaskReports(taskid);
+  }
+
+  @Override
+  public void pushTaskLog(String taskid, File logFile)
+  {
+    log.debug("Skipping task log push for task[%s]", taskid);

Review Comment:
   I think log pushing should be enabled by default.
   But there should be a config so that we can turn it off if needed.
   The same config could be used for controlling log killing as well.



##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   To ensure that extensions register themselves correctly as a valid type for say `druid.indexer.logs.switching.logsType`, you would need to add a utility method in `Binders`, say `bindTaskLogs`.
   
   ```java
   public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz) {
       // bind to `druid.indexer.logs.type`
       // bind to `druid.indexer.logs.switching.reportsType`
       // bind to `druid.indexer.logs.switching.logsType`
   }
   ```



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/ExternalTaskLogs.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.java.util.emitter.EmittingLogger;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ExternalTaskLogs implements TaskLogs

Review Comment:
   Technically, all implementations of `TaskLogs` are external to Druid anyway.
   If we go the `switching` route, this can be renamed to `SwitchingTaskLogs` or equivalent.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2262498948


##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -208,7 +200,9 @@
         "k8s"
     ));
 
-    if (adapter != null && !MultiContainerTaskAdapter.TYPE.equals(adapter) && kubernetesTaskRunnerConfig.isSidecarSupport()) {
+    if (adapter != null
+        && !MultiContainerTaskAdapter.TYPE.equals(adapter)
+        && kubernetesTaskRunnerConfig.isSidecarSupport()) {

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [KubernetesTaskRunnerConfig.isSidecarSupport](1) should be avoided because it has been deprecated.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/9946)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2263222331


##########
indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Scopes;
+import com.google.inject.name.Names;
+import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
+import org.apache.druid.jackson.JacksonModule;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.executable.ExecutableValidator;
+import javax.validation.metadata.BeanDescriptor;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.Set;
+
+public class IndexingServiceTaskLogsModuleTest
+{
+
+  @Test
+  public void test_switchingTaskLogs_shouldUseDefaultWhenNoPusherConfigured()
+  {
+    Properties props = new Properties();
+    props.setProperty("druid.indexer.logs.type", "switching");
+    props.setProperty("druid.indexer.logs.switching.defaultType", "file");
+
+    Injector injector = Guice.createInjector(
+        binder -> {
+          binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
+          binder.bind(Properties.class).toInstance(props);
+          binder.bind(Validator.class).toInstance(new MockValidator());

Review Comment:
   Okay, in that case, include `new ConfigModule()` in the list of modules here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259664008


##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -81,12 +85,16 @@
 public class KubernetesOverlordModule implements DruidModule
 {
 
-  private static final Logger log = new Logger(KubernetesOverlordModule.class);
+  private static final Logger log = new EmittingLogger(KubernetesOverlordModule.class);

Review Comment:
   my bad, it's not



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259662030


##########
processing/src/main/java/org/apache/druid/guice/Binders.java:
##########
@@ -59,4 +60,11 @@ public static MapBinder<String, TaskLogs> taskLogsBinder(Binder binder)
   {
     return PolyBind.optionBinder(binder, Key.get(TaskLogs.class));
   }
+
+  public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz)
+  {
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class)).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("defaultType"))).addBinding(type).to(clazz);
+    binder.bind(Key.get(TaskLogs.class, Names.named(type))).to(clazz);

Review Comment:
   Currently, in the provider implementation. However let me see if i can remove these after creating optional bindings.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2258853857


##########
processing/src/main/java/org/apache/druid/guice/Binders.java:
##########
@@ -59,4 +60,11 @@ public static MapBinder<String, TaskLogs> taskLogsBinder(Binder binder)
   {
     return PolyBind.optionBinder(binder, Key.get(TaskLogs.class));
   }
+
+  public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz)

Review Comment:
   Please add a short javadoc to this.



##########
processing/src/test/java/org/apache/druid/guice/BindersTest.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.name.Names;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.Properties;
+
+class BindersTest

Review Comment:
   Thanks for adding this!



##########
processing/src/main/java/org/apache/druid/tasklogs/TaskLogPusher.java:
##########
@@ -39,4 +39,9 @@ default void pushTaskReports(String taskid, File reportFile) throws IOException
   default void pushTaskStatus(String taskid, File reportFile) throws IOException
   {
   }
+
+  default boolean logPushEnabled()

Review Comment:
   It seems weird to have a flag to disable the one thing that this interface is meant to do.
   Given that we already have a `noop` impl, where do we need this?



##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -81,12 +85,16 @@
 public class KubernetesOverlordModule implements DruidModule
 {
 
-  private static final Logger log = new Logger(KubernetesOverlordModule.class);
+  private static final Logger log = new EmittingLogger(KubernetesOverlordModule.class);

Review Comment:
   Nit: Why is this change required?



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+  private final TaskLogs reportTaskLogs;
+  private final TaskLogs logStreamer;
+  private final TaskLogs logPusher;
+
+  @Inject
+  public SwitchingTaskLogs(
+      @Named("reports") TaskLogs reportTaskLogs,

Review Comment:
   There should be an argument for the default type as well.
   The other args can be treated as optional bindings.
   If they turn out to be not bound (i.e. null), `SwitchingTaskLogs` uses the default one for them.



##########
services/src/main/java/org/apache/druid/cli/CliOverlord.java:
##########
@@ -464,6 +455,38 @@ private void configureOverlordHelpers(Binder binder)
     );
   }
 
+  private void bindTaskLogStreamer(Binder binder)
+  {
+    String logsType = properties.getProperty("druid.indexer.logs.type");
+    if ("switching".equals(logsType)) {
+      bindSwitchingTaskLogs(binder);
+    } else {
+      bindSwitchingTaskLogStreamer(binder);
+    }
+  }
+
+  private static void bindSwitchingTaskLogStreamer(Binder binder)
+  {
+    binder.bind(TaskLogStreamer.class)
+          .to(SwitchingTaskLogStreamer.class)
+          .in(LazySingleton.class);
+    binder.bind(new TypeLiteral<List<TaskLogStreamer>>() {})
+          .toProvider(new ListProvider<TaskLogStreamer>().add(TaskLogs.class))
+          .in(LazySingleton.class);
+
+    binder.bind(TaskLogStreamer.class)
+          .annotatedWith(Names.named("taskstreamer"))
+          .to(TaskRunnerTaskLogStreamer.class)
+          .in(LazySingleton.class);
+  }
+
+  private static void bindSwitchingTaskLogs(Binder binder)

Review Comment:
   The contents of this method can be inlined.



##########
processing/src/main/java/org/apache/druid/guice/Binders.java:
##########
@@ -59,4 +60,11 @@ public static MapBinder<String, TaskLogs> taskLogsBinder(Binder binder)
   {
     return PolyBind.optionBinder(binder, Key.get(TaskLogs.class));
   }
+
+  public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz)
+  {
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class)).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("defaultType"))).addBinding(type).to(clazz);

Review Comment:
   "defaultType" should be a constant in `TaskLogs` or `SwitchingTaskLogs`.
   Use a more qualified name like `switching.defaultType` or something.



##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -290,16 +298,83 @@ public RunnerStrategy get()
   private void configureTaskLogs(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, PROPERTY_PREFIX_SWITCHING + ".defaultType", Key.get(TaskLogs.class, Names.named("defaultType")), Key.get(FileTaskLogs.class));
+
     JsonConfigProvider.bind(binder, "druid.indexer.logs", FileTaskLogsConfig.class);
 
     final MapBinder<String, TaskLogs> taskLogBinder = Binders.taskLogsBinder(binder);
-    taskLogBinder.addBinding("noop").to(NoopTaskLogs.class).in(LazySingleton.class);
-    taskLogBinder.addBinding("file").to(FileTaskLogs.class).in(LazySingleton.class);
+
+    taskLogBinder.addBinding("switching").to(SwitchingTaskLogs.class);
+    Binders.bindTaskLogs(binder, "noop", NoopTaskLogs.class);
+    Binders.bindTaskLogs(binder, "file", FileTaskLogs.class);
+
     binder.bind(NoopTaskLogs.class).in(LazySingleton.class);
     binder.bind(FileTaskLogs.class).in(LazySingleton.class);
+    binder.bind(SwitchingTaskLogs.class).in(LazySingleton.class);
 
     binder.bind(TaskLogPusher.class).to(TaskLogs.class);
     binder.bind(TaskLogKiller.class).to(TaskLogs.class);
+    binder.bind(TaskPayloadManager.class).to(TaskLogs.class);
+  }
+
+  @Provides
+  @Named("streamer")

Review Comment:
   Please move these constants to `SwitchingTaskLogs` and use more consistent names like `switching.logStreamType`.



##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java:
##########
@@ -792,7 +792,7 @@ public Response doGetLog(
         return Response.status(Response.Status.NOT_FOUND)
                        .entity(
                            "No log was found for this task. "
-                           + "The task may not exist, or it may not have begun running yet."
+                           + "The task may not exist, it may not have begun running yet or the taskStream configuration may be faulty, kindly verify the same."

Review Comment:
   ```suggestion
                              + "No logs found for this task. Ensure that the task is running and logging is configured correctly."
   ```



##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -81,12 +85,16 @@
 public class KubernetesOverlordModule implements DruidModule
 {
 
-  private static final Logger log = new Logger(KubernetesOverlordModule.class);
+  private static final Logger log = new EmittingLogger(KubernetesOverlordModule.class);
   private static final String K8SANDWORKER_PROPERTIES_PREFIX = IndexingServiceModuleHelper.INDEXER_RUNNER_PROPERTY_PREFIX
                                                                + ".k8sAndWorker";
   private static final String RUNNERSTRATEGY_PROPERTIES_FORMAT_STRING = K8SANDWORKER_PROPERTIES_PREFIX
                                                                         + ".runnerStrategy.%s";
   private static final String HTTPCLIENT_PROPERITES_PREFIX = K8SANDWORKER_PROPERTIES_PREFIX + ".http";
+  private static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  private static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";
+  private static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".streamType";
+  private static final String PROPERTY_KEY_SWITCHING_REPORTS_TYPE = PROPERTY_PREFIX_SWITCHING + ".reportsType";

Review Comment:
   These constants should exist in `SwitchingTaskLogs`.



##########
processing/src/main/java/org/apache/druid/guice/Binders.java:
##########
@@ -59,4 +60,11 @@ public static MapBinder<String, TaskLogs> taskLogsBinder(Binder binder)
   {
     return PolyBind.optionBinder(binder, Key.get(TaskLogs.class));
   }
+
+  public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz)
+  {
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class)).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("defaultType"))).addBinding(type).to(clazz);
+    binder.bind(Key.get(TaskLogs.class, Names.named(type))).to(clazz);

Review Comment:
   Where would we need to refer to a `TaskLogs` object by the name of its implementation?



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/config/FileTaskLogsConfig.java:
##########
@@ -19,11 +19,13 @@
 
 package org.apache.druid.indexing.common.config;
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 import javax.validation.constraints.NotNull;
 import java.io.File;
 
+@JsonIgnoreProperties(ignoreUnknown = true)

Review Comment:
   Did you run into any issue while deserializing?
   Unknown properties should already be ignored by default.



##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -290,16 +298,83 @@ public RunnerStrategy get()
   private void configureTaskLogs(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, PROPERTY_PREFIX_SWITCHING + ".defaultType", Key.get(TaskLogs.class, Names.named("defaultType")), Key.get(FileTaskLogs.class));
+
     JsonConfigProvider.bind(binder, "druid.indexer.logs", FileTaskLogsConfig.class);
 
     final MapBinder<String, TaskLogs> taskLogBinder = Binders.taskLogsBinder(binder);
-    taskLogBinder.addBinding("noop").to(NoopTaskLogs.class).in(LazySingleton.class);
-    taskLogBinder.addBinding("file").to(FileTaskLogs.class).in(LazySingleton.class);
+
+    taskLogBinder.addBinding("switching").to(SwitchingTaskLogs.class);
+    Binders.bindTaskLogs(binder, "noop", NoopTaskLogs.class);
+    Binders.bindTaskLogs(binder, "file", FileTaskLogs.class);
+
     binder.bind(NoopTaskLogs.class).in(LazySingleton.class);
     binder.bind(FileTaskLogs.class).in(LazySingleton.class);
+    binder.bind(SwitchingTaskLogs.class).in(LazySingleton.class);
 
     binder.bind(TaskLogPusher.class).to(TaskLogs.class);
     binder.bind(TaskLogKiller.class).to(TaskLogs.class);
+    binder.bind(TaskPayloadManager.class).to(TaskLogs.class);

Review Comment:
   I wonder if these bindings are really needed here. Doesn't the other module `IndexingServiceTaskLogsModule` already perform the same bindings on the Overlord?



##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -290,16 +298,83 @@ public RunnerStrategy get()
   private void configureTaskLogs(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, PROPERTY_PREFIX_SWITCHING + ".defaultType", Key.get(TaskLogs.class, Names.named("defaultType")), Key.get(FileTaskLogs.class));
+
     JsonConfigProvider.bind(binder, "druid.indexer.logs", FileTaskLogsConfig.class);
 
     final MapBinder<String, TaskLogs> taskLogBinder = Binders.taskLogsBinder(binder);
-    taskLogBinder.addBinding("noop").to(NoopTaskLogs.class).in(LazySingleton.class);
-    taskLogBinder.addBinding("file").to(FileTaskLogs.class).in(LazySingleton.class);
+
+    taskLogBinder.addBinding("switching").to(SwitchingTaskLogs.class);
+    Binders.bindTaskLogs(binder, "noop", NoopTaskLogs.class);
+    Binders.bindTaskLogs(binder, "file", FileTaskLogs.class);
+
     binder.bind(NoopTaskLogs.class).in(LazySingleton.class);
     binder.bind(FileTaskLogs.class).in(LazySingleton.class);
+    binder.bind(SwitchingTaskLogs.class).in(LazySingleton.class);
 
     binder.bind(TaskLogPusher.class).to(TaskLogs.class);
     binder.bind(TaskLogKiller.class).to(TaskLogs.class);
+    binder.bind(TaskPayloadManager.class).to(TaskLogs.class);
+  }
+
+  @Provides
+  @Named("streamer")
+  public TaskLogs provideStreamer(

Review Comment:
   This logic shouldn't be needed here, `SwitchingTaskLogs` should handle it implicitly.
   Same for the other methods.



##########
services/src/main/java/org/apache/druid/cli/CliOverlord.java:
##########
@@ -464,6 +455,38 @@ private void configureOverlordHelpers(Binder binder)
     );
   }
 
+  private void bindTaskLogStreamer(Binder binder)
+  {
+    String logsType = properties.getProperty("druid.indexer.logs.type");
+    if ("switching".equals(logsType)) {
+      bindSwitchingTaskLogs(binder);
+    } else {
+      bindSwitchingTaskLogStreamer(binder);
+    }
+  }
+
+  private static void bindSwitchingTaskLogStreamer(Binder binder)

Review Comment:
   This method can be inlined too since the calling method itself is small enough.



##########
services/src/main/java/org/apache/druid/cli/CliOverlord.java:
##########
@@ -464,6 +455,38 @@ private void configureOverlordHelpers(Binder binder)
     );
   }
 
+  private void bindTaskLogStreamer(Binder binder)
+  {
+    String logsType = properties.getProperty("druid.indexer.logs.type");
+    if ("switching".equals(logsType)) {
+      bindSwitchingTaskLogs(binder);

Review Comment:
   I am not entirely sure if we should be doing this.
   For the Overlord, `SwitchingTaskLogs` should still be treated as one of the multiple bound log streamers that the `Overlord` would look at when asked for the logs of a task.
   
   Maybe I am missing some use cases. Could you please explain this change?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2264536306


##########
processing/src/main/java/org/apache/druid/tasklogs/SwitchingTaskLogs.java:
##########
@@ -17,47 +17,52 @@
  * under the License.
  */
 
-package org.apache.druid.indexing.common.tasklogs;
+package org.apache.druid.tasklogs;
 
 import com.google.common.base.Optional;
 import com.google.inject.Inject;
 import com.google.inject.name.Named;
-import org.apache.druid.tasklogs.TaskLogs;
+import org.apache.druid.common.config.Configs;
 
 import javax.annotation.Nullable;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 
+/**
+ * Implements {@link TaskLogs} by delegating to different task log providers based on the functionality required.
+ * This allows for different handling of reports, streaming logs, and pushing logs with a default fallback.
+ */
+
 public class SwitchingTaskLogs implements TaskLogs
 {
 
-  public static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
-  public static final String PROPERTY_KEY_SWITCHING_DEFAULT_TYPE = PROPERTY_PREFIX_SWITCHING + ".defaultType";
-  public static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";
-  public static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".streamType";
-  public static final String PROPERTY_KEY_SWITCHING_REPORTS_TYPE = PROPERTY_PREFIX_SWITCHING + ".reportsType";
+  public static final String PROPERTY_PREFIX = "druid.indexer.logs.switching";
+  public static final String PROPERTY_DEFAULT_TYPE = PROPERTY_PREFIX + ".defaultType";
+  public static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX + ".logPushType";

Review Comment:
   Similar change for other props:
   ```suggestion
     public static final String PROPERTY_LOG_PUSH_TYPE = PROPERTY_PREFIX + ".logPushType";
   ```



##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -113,4 +79,23 @@ public void configure(Binder binder)
     binder.bind(TaskLogKiller.class).to(TaskLogs.class);
     binder.bind(TaskPayloadManager.class).to(TaskLogs.class);
   }
+
+  private void bindTaskLogImplementation(
+      Binder binder,
+      String propertyKeySwitchingStreamType,
+      String keySwitchingStream

Review Comment:
   ```suggestion
         String typeName
   ```



##########
processing/src/test/java/org/apache/druid/tasklogs/SwitchingTaskLogsTest.java:
##########
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.tasklogs;
+
+import com.google.common.base.Optional;
+import org.easymock.EasyMock;
+import org.easymock.EasyMockRunner;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+@RunWith(EasyMockRunner.class)
+public class SwitchingTaskLogsTest extends EasyMockSupport
+{
+  @Mock
+  private TaskLogs defaultTaskLogs;
+
+  @Mock
+  private TaskLogs reportTaskLogs;
+
+  @Mock
+  private TaskLogs streamerTaskLogs;
+
+  @Mock
+  private TaskLogs pusherTaskLogs;
+
+  private SwitchingTaskLogs taskLogs;
+
+  @Before
+  public void setUp()
+  {
+    taskLogs = new SwitchingTaskLogs(defaultTaskLogs, reportTaskLogs, streamerTaskLogs, pusherTaskLogs);
+  }
+
+  @Test
+  public void test_streamTaskLog_shouldUseStreamerTaskLogs() throws IOException
+  {
+    String taskId = "test-task-id";
+    long offset = 0L;
+    InputStream logStream = new ByteArrayInputStream("test log content".getBytes(StandardCharsets.UTF_8));
+
+    EasyMock.expect(streamerTaskLogs.streamTaskLog(taskId, offset)).andReturn(Optional.of(logStream));
+    replayAll();
+
+    Optional<InputStream> actualLogStream = taskLogs.streamTaskLog(taskId, offset);
+    Assert.assertTrue(actualLogStream.isPresent());
+    Assert.assertEquals(logStream, actualLogStream.get());
+
+    verifyAll();
+  }
+
+  @Test
+  public void test_streamTaskReports_shouldUseReportTaskLogs() throws IOException
+  {
+    String taskId = "test-task-id";
+    InputStream reportStream = new ByteArrayInputStream("test report content".getBytes(StandardCharsets.UTF_8));
+
+    EasyMock.expect(reportTaskLogs.streamTaskReports(taskId)).andReturn(Optional.of(reportStream));
+    replayAll();
+
+    Optional<InputStream> actualReportStream = taskLogs.streamTaskReports(taskId);
+    Assert.assertTrue(actualReportStream.isPresent());
+    Assert.assertEquals(reportStream, actualReportStream.get());
+
+    verifyAll();
+  }
+
+  @Test
+  public void test_streamTaskStatus_shouldUseReportTaskLogs() throws IOException
+  {
+    String taskId = "test-task-id";
+    InputStream statusStream = new ByteArrayInputStream("test status content".getBytes(StandardCharsets.UTF_8));
+
+    EasyMock.expect(reportTaskLogs.streamTaskStatus(taskId)).andReturn(Optional.of(statusStream));
+    replayAll();
+
+    Optional<InputStream> actualStatusStream = taskLogs.streamTaskStatus(taskId);
+    Assert.assertTrue(actualStatusStream.isPresent());
+    Assert.assertEquals(statusStream, actualStatusStream.get());
+
+    verifyAll();
+  }
+
+  @Test
+  public void test_streamTaskPayload_shouldUseReportTaskLogs() throws IOException
+  {
+    String taskId = "test-task-id";
+    InputStream payloadStream = new ByteArrayInputStream("test payload content".getBytes(StandardCharsets.UTF_8));
+
+    EasyMock.expect(reportTaskLogs.streamTaskPayload(taskId)).andReturn(Optional.of(payloadStream));
+    replayAll();
+
+    Optional<InputStream> actualPayloadStream = taskLogs.streamTaskPayload(taskId);
+    Assert.assertTrue(actualPayloadStream.isPresent());
+    Assert.assertEquals(payloadStream, actualPayloadStream.get());
+
+    verifyAll();
+  }
+
+  @Test
+  public void test_pushTaskLog_shouldUsePusherTaskLogs() throws IOException
+  {
+    String taskId = "test-task-id";
+    File logFile = new File("test.log");
+
+    pusherTaskLogs.pushTaskLog(taskId, logFile);
+    EasyMock.expectLastCall();
+    replayAll();
+
+    taskLogs.pushTaskLog(taskId, logFile);
+
+    verifyAll();
+  }
+
+  @Test
+  public void test_pushTaskReports_shouldUseReportTaskLogs() throws IOException
+  {
+    String taskId = "test-task-id";
+    File logFile = new File("test.log");
+
+    reportTaskLogs.pushTaskReports(taskId, logFile);
+    EasyMock.expectLastCall();
+    replayAll();
+
+    taskLogs.pushTaskReports(taskId, logFile);
+
+    verifyAll();
+  }
+
+  @Test
+  public void test_pushTaskStatus_shouldUseReportTaskLogs() throws IOException
+  {
+    String taskId = "test-task-id";
+    File logFile = new File("test.log");
+
+    reportTaskLogs.pushTaskStatus(taskId, logFile);
+    EasyMock.expectLastCall();
+    replayAll();
+
+    taskLogs.pushTaskStatus(taskId, logFile);
+
+    verifyAll();
+  }
+
+  @Test
+  public void test_pushTaskPayload_shouldUseReportTaskLogs() throws IOException
+  {
+    String taskId = "test-task-id";
+    File logFile = new File("test.log");
+
+    reportTaskLogs.pushTaskPayload(taskId, logFile);
+    EasyMock.expectLastCall();
+    replayAll();
+
+    taskLogs.pushTaskPayload(taskId, logFile);
+
+    verifyAll();
+  }
+
+  @Test
+  public void test_killAll_shouldUseReportTaskLogs() throws IOException
+  {
+    reportTaskLogs.killAll();
+    EasyMock.expectLastCall();
+    replayAll();
+
+    taskLogs.killAll();
+
+    verifyAll();
+  }
+
+  @Test
+  public void test_killOlderThan_shouldUseReportTaskLogs() throws IOException

Review Comment:
   Nit: `uses` instead of `shouldUse` reads better.
   ```suggestion
     public void test_killOlderThan_usesReportTaskLogs() throws IOException
   ```



##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -113,4 +79,23 @@ public void configure(Binder binder)
     binder.bind(TaskLogKiller.class).to(TaskLogs.class);
     binder.bind(TaskPayloadManager.class).to(TaskLogs.class);
   }
+
+  private void bindTaskLogImplementation(
+      Binder binder,
+      String propertyKeySwitchingStreamType,

Review Comment:
   ```suggestion
         String propertyKey,
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2244931558


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   This sounds good, in my head I am looking to provide the flexibility just for log types for now. The `delegated` / `reportType` could take care of other task responsibilities. So finally, imo it should look like one of these.
   
   ### Option 1 [asking for explicit types for each responsibility]
   
   ```
   druid.indexer.logs.type=switching
   druid.indexer.logs.switching.reportsType=file
   druid.indexer.logs.switching.payloadManagerType=file
   druid.indexer.logs.switching.logsType=switching
   druid.indexer.logs.switching.logsType.logsPushType=noop
   druid.indexer.logs.switching.logsType.logsStreamType=file
   ```
   
   translating to
   
   ```java
   public class SwitchingTaskLogs implements TaskLogs
   {
     private final TaskLogs reportDelegate;
     private final TaskLogs payloadDelegate;
     private final TaskLogs logDelegate;
   
     @Inject
     public SwitchingTaskLogs(
         @Named("report") TaskLogs reportDelegate,
         @Named("payload") TaskLogs payloadDelegate,
         @Named("log") TaskLogs logDelegate
      )
     {
   
       this.reportDelegate = reportDelegate;
       this.payloadDelegate = payloadDelegate;
       this.logDelegate = logDelegate;
     }
   }
   
   public class TaskLogManager implements TaskLogs  // this / some flavour of switching task log will be injected as switching log delegate to handle the task related responsibilities with an appropriate factory placed in front.
   {
     private final TaskLogStreamer streamer;
     private final TaskLogPusher pusher; 
   
     @Inject
     public TaskLogManager(
         @Named("taskLogPusher") TaskLogs pusher,
         @Named("taskLogStreamer") TaskLogs streamer,
      )
     {
       this.pusher = pusher;
       this.streamer = streamer;
     }
   }
   ```
   
   or we could create one like 
   
   ### Option 2 [just keeping log handler separate while keeping the rest of the responsibilities with the delegate class]
   
   ```
   druid.indexer.logs.type=switching
   druid.indexer.logs.switching.delegate=file
   druid.indexer.logs.switching.logsHandlerType=switching
   druid.indexer.logs.switching.logHandler.logsPushType=noop
   druid.indexer.logs.switching.logHandler.logsStreamType=file
   ```
   
   ```java
   public class SwitchingTaskLogs implements TaskLogs
   {
     private final TaskLogs delegate;
     private final TaskLogs switchingLogDelegate; 
   
     @Inject
     public SwitchingTaskLogs(
         @Named("default") TaskLogs defaultDelegate,
         @Named("log") TaskLogs logDelegate,
      )
     {
       this.defaultDelegate = defaultDelegate;
       this.logDelegate = logDelegate;
     }
   }
   
   // the TaskLogManager stays the same.
   ```
   
   **I am personally leaning towards option 2 given the usecase in hand. what do you folks think?**



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2250467226


##########
indexing-service/pom.xml:
##########
@@ -267,6 +267,10 @@
             <artifactId>jdbi</artifactId>
             <scope>test</scope>
         </dependency>
+      <dependency>
+        <groupId>org.apache.calcite.avatica</groupId>
+        <artifactId>avatica-core</artifactId>

Review Comment:
   This should not be needed in indexing-service.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #18341:
URL: https://github.com/apache/druid/pull/18341#issuecomment-3149209759

   Thanks for the update, @uds5501 ! I will try to take a look at the changes today.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2262768679


##########
extensions-core/kubernetes-overlord-extensions/src/test/java/org/apache/druid/k8s/overlord/KubernetesPeonLifecycleTest.java:
##########
@@ -339,7 +339,6 @@ public void test_join_withoutJob_returnsFailedTaskStatus() throws IOException
     EasyMock.expectLastCall().once();
     stateListener.stateChanged(KubernetesPeonLifecycle.State.STOPPED, ID);
     EasyMock.expectLastCall().once();
-

Review Comment:
   The changes to this file seem unintentional. Please revert these.



##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -20,32 +20,94 @@
 package org.apache.druid.guice;
 
 import com.google.inject.Binder;
+import com.google.inject.Inject;
 import com.google.inject.Key;
 import com.google.inject.Module;
 import com.google.inject.multibindings.MapBinder;
+import com.google.inject.name.Names;
 import org.apache.druid.indexing.common.config.FileTaskLogsConfig;
 import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
 import org.apache.druid.tasklogs.NoopTaskLogs;
 import org.apache.druid.tasklogs.TaskLogKiller;
 import org.apache.druid.tasklogs.TaskLogPusher;
 import org.apache.druid.tasklogs.TaskLogs;
 import org.apache.druid.tasklogs.TaskPayloadManager;
 
+import java.util.Properties;
+
 /**
+ *
  */
 public class IndexingServiceTaskLogsModule implements Module
 {
+  private Properties props;
+
+  @Inject
+  public IndexingServiceTaskLogsModule(Properties props)

Review Comment:
   This will help you retain the zero arg constructor.
   
   ```suggestion
     public setProperties(Properties props)
   ```



##########
processing/src/main/java/org/apache/druid/guice/Binders.java:
##########
@@ -59,4 +60,16 @@ public static MapBinder<String, TaskLogs> taskLogsBinder(Binder binder)
   {
     return PolyBind.optionBinder(binder, Key.get(TaskLogs.class));
   }
+
+  /**
+   * Binds implementation of {@link TaskLogs} to the named keys for injection.
+   */
+  public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz)
+  {
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class)).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.reportType"))).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.streamType"))).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.pushType"))).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.defaultType"))).addBinding(type).to(clazz);

Review Comment:
   Please use the constants from `SwitchingTaskLogs`.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+
+  public static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  public static final String PROPERTY_KEY_SWITCHING_DEFAULT_TYPE = PROPERTY_PREFIX_SWITCHING + ".defaultType";
+  public static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";
+  public static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".streamType";
+  public static final String PROPERTY_KEY_SWITCHING_REPORTS_TYPE = PROPERTY_PREFIX_SWITCHING + ".reportsType";
+
+  public static final String KEY_SWITCHING_REPORTS = "switching.reportType";
+  public static final String KEY_SWITCHING_STREAM = "switching.streamType";
+  public static final String KEY_SWITCHING_PUSH = "switching.pushType";

Review Comment:
   `pushType` seems ambiguous, use `logPushType` instead.



##########
processing/src/main/java/org/apache/druid/guice/Binders.java:
##########
@@ -59,4 +60,16 @@ public static MapBinder<String, TaskLogs> taskLogsBinder(Binder binder)
   {
     return PolyBind.optionBinder(binder, Key.get(TaskLogs.class));
   }
+
+  /**
+   * Binds implementation of {@link TaskLogs} to the named keys for injection.
+   */
+  public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz)

Review Comment:
   ```suggestion
     public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> taskLogsType)
   ```



##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -20,32 +20,94 @@
 package org.apache.druid.guice;
 
 import com.google.inject.Binder;
+import com.google.inject.Inject;
 import com.google.inject.Key;
 import com.google.inject.Module;
 import com.google.inject.multibindings.MapBinder;
+import com.google.inject.name.Names;
 import org.apache.druid.indexing.common.config.FileTaskLogsConfig;
 import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
 import org.apache.druid.tasklogs.NoopTaskLogs;
 import org.apache.druid.tasklogs.TaskLogKiller;
 import org.apache.druid.tasklogs.TaskLogPusher;
 import org.apache.druid.tasklogs.TaskLogs;
 import org.apache.druid.tasklogs.TaskPayloadManager;
 
+import java.util.Properties;
+
 /**
+ *
  */
 public class IndexingServiceTaskLogsModule implements Module
 {
+  private Properties props;
+
+  @Inject
+  public IndexingServiceTaskLogsModule(Properties props)
+  {
+    this.props = props;
+  }
+
   @Override
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(
+        binder,
+        SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_DEFAULT_TYPE,
+        Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_DEFAULT)),
+        Key.get(FileTaskLogs.class)
+    );
+
+    if (props != null && props.getProperty(SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_PUSH_TYPE) != null) {
+      PolyBind.createChoice(
+          binder,
+          SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_PUSH_TYPE,
+          Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_PUSH)),
+          null
+      );
+    } else {
+      binder.bind(Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_PUSH)))
+            .toProvider(() -> null);
+    }
+
+    if (props != null && props.getProperty(SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_REPORTS_TYPE) != null) {
+      PolyBind.createChoice(
+          binder,
+          SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_REPORTS_TYPE,
+          Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_REPORTS)),
+          null
+      );
+    } else {
+      binder.bind(Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_REPORTS)))
+            .toProvider(() -> null);
+    }
+
+    if (props != null && props.getProperty(SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_STREAM_TYPE) != null) {
+      PolyBind.createChoice(
+          binder,
+          SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_STREAM_TYPE,
+          Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_STREAM)),
+          null
+      );
+    } else {
+      binder.bind(Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_STREAM)))
+            .toProvider(() -> null);
+    }

Review Comment:
   Please put this logic in a method so that it can be reused for the 3 cases.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs

Review Comment:
   Please add a javadoc.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+
+  public static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";

Review Comment:
   Please remove the word `SWITCHING` from all the constants since they already reside in the `SwitchingTaskLogs` class.
   
   ```suggestion
     public static final String PROPERTY_PREFIX = "druid.indexer.logs.switching";
   ```



##########
indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Scopes;
+import com.google.inject.name.Names;
+import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
+import org.apache.druid.jackson.JacksonModule;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.executable.ExecutableValidator;
+import javax.validation.metadata.BeanDescriptor;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.Set;
+
+public class IndexingServiceTaskLogsModuleTest
+{
+
+  @Test
+  public void test_switchingTaskLogs_shouldUseDefaultWhenNoPusherConfigured()
+  {
+    Properties props = new Properties();
+    props.setProperty("druid.indexer.logs.type", "switching");
+    props.setProperty("druid.indexer.logs.switching.defaultType", "file");
+
+    Injector injector = Guice.createInjector(
+        binder -> {
+          binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
+          binder.bind(Properties.class).toInstance(props);
+          binder.bind(Validator.class).toInstance(new MockValidator());
+        },
+        new IndexingServiceTaskLogsModule(props),
+        new JacksonModule()
+    );
+
+    TaskLogs taskLogs = injector.getInstance(TaskLogs.class);
+    Assert.assertTrue(taskLogs instanceof SwitchingTaskLogs);
+  }
+
+  @Test
+  public void test_providePusher_shouldReturnConfiguredImplementaions()
+  {
+    Properties props = new Properties();
+    props.setProperty("druid.indexer.logs.type", "switching");
+    props.setProperty("druid.indexer.logs.switching.defaultType", "noop");
+    props.setProperty("druid.indexer.logs.switching.pushType", "file");
+    props.setProperty("druid.indexer.logs.switching.reportsType", "noop");
+    props.setProperty("druid.indexer.logs.switching.streamType", "file");
+
+    Injector injector = Guice.createInjector(
+        binder -> {
+          binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
+          binder.bind(Properties.class).toInstance(props);
+          binder.bind(Validator.class).toInstance(new MockValidator());
+        },
+        new IndexingServiceTaskLogsModule(props),
+        new JacksonModule()
+    );

Review Comment:
   This can be put in a method for reuse in all the tests.



##########
indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Scopes;
+import com.google.inject.name.Names;
+import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
+import org.apache.druid.jackson.JacksonModule;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.executable.ExecutableValidator;
+import javax.validation.metadata.BeanDescriptor;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.Set;
+
+public class IndexingServiceTaskLogsModuleTest
+{
+
+  @Test
+  public void test_switchingTaskLogs_shouldUseDefaultWhenNoPusherConfigured()
+  {
+    Properties props = new Properties();
+    props.setProperty("druid.indexer.logs.type", "switching");
+    props.setProperty("druid.indexer.logs.switching.defaultType", "file");
+
+    Injector injector = Guice.createInjector(
+        binder -> {
+          binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
+          binder.bind(Properties.class).toInstance(props);
+          binder.bind(Validator.class).toInstance(new MockValidator());

Review Comment:
   Why is this needed?



##########
indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Scopes;
+import com.google.inject.name.Names;
+import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
+import org.apache.druid.jackson.JacksonModule;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.executable.ExecutableValidator;
+import javax.validation.metadata.BeanDescriptor;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.Set;
+
+public class IndexingServiceTaskLogsModuleTest
+{
+
+  @Test
+  public void test_switchingTaskLogs_shouldUseDefaultWhenNoPusherConfigured()
+  {
+    Properties props = new Properties();
+    props.setProperty("druid.indexer.logs.type", "switching");
+    props.setProperty("druid.indexer.logs.switching.defaultType", "file");
+
+    Injector injector = Guice.createInjector(
+        binder -> {
+          binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
+          binder.bind(Properties.class).toInstance(props);
+          binder.bind(Validator.class).toInstance(new MockValidator());
+        },
+        new IndexingServiceTaskLogsModule(props),
+        new JacksonModule()
+    );
+
+    TaskLogs taskLogs = injector.getInstance(TaskLogs.class);
+    Assert.assertTrue(taskLogs instanceof SwitchingTaskLogs);
+  }
+
+  @Test
+  public void test_providePusher_shouldReturnConfiguredImplementaions()

Review Comment:
   ```suggestion
     public void test_switchingTaskLogs_usesConfiguredPusherType()
   ```



##########
indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Scopes;
+import com.google.inject.name.Names;
+import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
+import org.apache.druid.jackson.JacksonModule;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.executable.ExecutableValidator;
+import javax.validation.metadata.BeanDescriptor;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.Set;
+
+public class IndexingServiceTaskLogsModuleTest
+{
+
+  @Test
+  public void test_switchingTaskLogs_shouldUseDefaultWhenNoPusherConfigured()
+  {
+    Properties props = new Properties();
+    props.setProperty("druid.indexer.logs.type", "switching");
+    props.setProperty("druid.indexer.logs.switching.defaultType", "file");
+
+    Injector injector = Guice.createInjector(
+        binder -> {
+          binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
+          binder.bind(Properties.class).toInstance(props);
+          binder.bind(Validator.class).toInstance(new MockValidator());
+        },
+        new IndexingServiceTaskLogsModule(props),
+        new JacksonModule()
+    );
+
+    TaskLogs taskLogs = injector.getInstance(TaskLogs.class);
+    Assert.assertTrue(taskLogs instanceof SwitchingTaskLogs);

Review Comment:
   We should verify that the named types are being defaulted to `file`.



##########
processing/src/test/java/org/apache/druid/guice/BindersTest.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.name.Names;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.Properties;
+
+class BindersTest

Review Comment:
   Seems cleaner:
   ```suggestion
   public class BindersTest
   ```



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+
+  public static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  public static final String PROPERTY_KEY_SWITCHING_DEFAULT_TYPE = PROPERTY_PREFIX_SWITCHING + ".defaultType";
+  public static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";

Review Comment:
   ```suggestion
     public static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".logPushType";
   ```



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+
+  public static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  public static final String PROPERTY_KEY_SWITCHING_DEFAULT_TYPE = PROPERTY_PREFIX_SWITCHING + ".defaultType";
+  public static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";
+  public static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".streamType";

Review Comment:
   ```suggestion
     public static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".logStreamType";
   ```



##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -20,32 +20,94 @@
 package org.apache.druid.guice;
 
 import com.google.inject.Binder;
+import com.google.inject.Inject;
 import com.google.inject.Key;
 import com.google.inject.Module;
 import com.google.inject.multibindings.MapBinder;
+import com.google.inject.name.Names;
 import org.apache.druid.indexing.common.config.FileTaskLogsConfig;
 import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
 import org.apache.druid.tasklogs.NoopTaskLogs;
 import org.apache.druid.tasklogs.TaskLogKiller;
 import org.apache.druid.tasklogs.TaskLogPusher;
 import org.apache.druid.tasklogs.TaskLogs;
 import org.apache.druid.tasklogs.TaskPayloadManager;
 
+import java.util.Properties;
+
 /**
+ *
  */
 public class IndexingServiceTaskLogsModule implements Module
 {
+  private Properties props;
+
+  @Inject
+  public IndexingServiceTaskLogsModule(Properties props)
+  {
+    this.props = props;
+  }
+
   @Override
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(
+        binder,
+        SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_DEFAULT_TYPE,
+        Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_DEFAULT)),
+        Key.get(FileTaskLogs.class)
+    );
+
+    if (props != null && props.getProperty(SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_PUSH_TYPE) != null) {
+      PolyBind.createChoice(
+          binder,
+          SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_PUSH_TYPE,
+          Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_PUSH)),
+          null
+      );
+    } else {
+      binder.bind(Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_PUSH)))
+            .toProvider(() -> null);
+    }
+
+    if (props != null && props.getProperty(SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_REPORTS_TYPE) != null) {
+      PolyBind.createChoice(
+          binder,
+          SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_REPORTS_TYPE,
+          Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_REPORTS)),
+          null
+      );
+    } else {
+      binder.bind(Key.get(TaskLogs.class, Names.named(SwitchingTaskLogs.KEY_SWITCHING_REPORTS)))
+            .toProvider(() -> null);
+    }
+
+    if (props != null && props.getProperty(SwitchingTaskLogs.PROPERTY_KEY_SWITCHING_STREAM_TYPE) != null) {

Review Comment:
   `props` is never going to be null.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+
+  public static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  public static final String PROPERTY_KEY_SWITCHING_DEFAULT_TYPE = PROPERTY_PREFIX_SWITCHING + ".defaultType";

Review Comment:
   ```suggestion
     public static final String PROPERTY_DEFAULT_TYPE = PROPERTY_PREFIX_SWITCHING + ".defaultType";
   ```



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+
+  public static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  public static final String PROPERTY_KEY_SWITCHING_DEFAULT_TYPE = PROPERTY_PREFIX_SWITCHING + ".defaultType";
+  public static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";
+  public static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".streamType";
+  public static final String PROPERTY_KEY_SWITCHING_REPORTS_TYPE = PROPERTY_PREFIX_SWITCHING + ".reportsType";
+
+  public static final String KEY_SWITCHING_REPORTS = "switching.reportType";
+  public static final String KEY_SWITCHING_STREAM = "switching.streamType";
+  public static final String KEY_SWITCHING_PUSH = "switching.pushType";
+  public static final String KEY_SWITCHING_DEFAULT = "switching.defaultType";
+
+  private final TaskLogs reportTaskLogs;
+  private final TaskLogs logStreamer;
+  private final TaskLogs logPusher;
+
+  @Inject
+  public SwitchingTaskLogs(
+      @Nullable @Named(KEY_SWITCHING_DEFAULT) TaskLogs defaultTaskLogs,
+      @Nullable @Named(KEY_SWITCHING_REPORTS) TaskLogs reportTaskLogs,
+      @Nullable @Named(KEY_SWITCHING_STREAM) TaskLogs logStreamer,
+      @Nullable @Named(KEY_SWITCHING_PUSH) TaskLogs logPusher
+  )
+  {
+    this.reportTaskLogs = reportTaskLogs != null ? reportTaskLogs : defaultTaskLogs;

Review Comment:
   ```suggestion
       this.reportTaskLogs = Configs.valueOrDefault(reportTaskLogs, defaultTaskLogs);
   ```



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+
+  public static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  public static final String PROPERTY_KEY_SWITCHING_DEFAULT_TYPE = PROPERTY_PREFIX_SWITCHING + ".defaultType";
+  public static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";
+  public static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".streamType";
+  public static final String PROPERTY_KEY_SWITCHING_REPORTS_TYPE = PROPERTY_PREFIX_SWITCHING + ".reportsType";
+
+  public static final String KEY_SWITCHING_REPORTS = "switching.reportType";
+  public static final String KEY_SWITCHING_STREAM = "switching.streamType";
+  public static final String KEY_SWITCHING_PUSH = "switching.pushType";
+  public static final String KEY_SWITCHING_DEFAULT = "switching.defaultType";
+
+  private final TaskLogs reportTaskLogs;
+  private final TaskLogs logStreamer;
+  private final TaskLogs logPusher;
+
+  @Inject
+  public SwitchingTaskLogs(
+      @Nullable @Named(KEY_SWITCHING_DEFAULT) TaskLogs defaultTaskLogs,
+      @Nullable @Named(KEY_SWITCHING_REPORTS) TaskLogs reportTaskLogs,

Review Comment:
   Should we call these `defaultDelegate` and `reportsDelegate` instead?



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogs.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import javax.annotation.Nullable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SwitchingTaskLogs implements TaskLogs
+{
+
+  public static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  public static final String PROPERTY_KEY_SWITCHING_DEFAULT_TYPE = PROPERTY_PREFIX_SWITCHING + ".defaultType";
+  public static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";
+  public static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".streamType";
+  public static final String PROPERTY_KEY_SWITCHING_REPORTS_TYPE = PROPERTY_PREFIX_SWITCHING + ".reportsType";
+
+  public static final String KEY_SWITCHING_REPORTS = "switching.reportType";

Review Comment:
   ```suggestion
     public static final String NAME_REPORTS_TYPE = "switching.reportType";
   ```



##########
indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Scopes;
+import com.google.inject.name.Names;
+import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
+import org.apache.druid.jackson.JacksonModule;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.executable.ExecutableValidator;
+import javax.validation.metadata.BeanDescriptor;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.Set;
+
+public class IndexingServiceTaskLogsModuleTest
+{
+
+  @Test
+  public void test_switchingTaskLogs_shouldUseDefaultWhenNoPusherConfigured()
+  {
+    Properties props = new Properties();
+    props.setProperty("druid.indexer.logs.type", "switching");
+    props.setProperty("druid.indexer.logs.switching.defaultType", "file");
+
+    Injector injector = Guice.createInjector(
+        binder -> {
+          binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
+          binder.bind(Properties.class).toInstance(props);
+          binder.bind(Validator.class).toInstance(new MockValidator());
+        },
+        new IndexingServiceTaskLogsModule(props),
+        new JacksonModule()
+    );
+
+    TaskLogs taskLogs = injector.getInstance(TaskLogs.class);
+    Assert.assertTrue(taskLogs instanceof SwitchingTaskLogs);
+  }
+
+  @Test
+  public void test_providePusher_shouldReturnConfiguredImplementaions()
+  {
+    Properties props = new Properties();
+    props.setProperty("druid.indexer.logs.type", "switching");
+    props.setProperty("druid.indexer.logs.switching.defaultType", "noop");
+    props.setProperty("druid.indexer.logs.switching.pushType", "file");
+    props.setProperty("druid.indexer.logs.switching.reportsType", "noop");
+    props.setProperty("druid.indexer.logs.switching.streamType", "file");
+
+    Injector injector = Guice.createInjector(
+        binder -> {
+          binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
+          binder.bind(Properties.class).toInstance(props);
+          binder.bind(Validator.class).toInstance(new MockValidator());
+        },
+        new IndexingServiceTaskLogsModule(props),
+        new JacksonModule()
+    );
+
+    TaskLogs pusher = injector.getInstance(Key.get(TaskLogs.class, Names.named("switching.pushType")));
+    Assert.assertTrue(pusher instanceof FileTaskLogs);
+    TaskLogs reports = injector.getInstance(Key.get(TaskLogs.class, Names.named("switching.reportType")));

Review Comment:
   Nit: Please use consistent names, e.g. `logPushType`, `reportsType`, `logStreamType`.



##########
indexing-service/src/test/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogsTest.java:
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.easymock.EasyMock;
+import org.easymock.EasyMockRunner;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+@RunWith(EasyMockRunner.class)
+public class SwitchingTaskLogsTest extends EasyMockSupport
+{
+  @Mock
+  private TaskLogs defaultTaskLogs;
+
+  @Mock
+  private TaskLogs reportTaskLogs;
+
+  @Mock
+  private TaskLogs streamerTaskLogs;
+
+  @Mock
+  private TaskLogs pusherTaskLogs;
+
+  private SwitchingTaskLogs taskLogs;
+
+  @Before
+  public void setUp()
+  {
+    taskLogs = new SwitchingTaskLogs(defaultTaskLogs, reportTaskLogs, streamerTaskLogs, pusherTaskLogs);
+  }
+
+  @Test
+  public void test_shouldUseIndividualLogs() throws IOException

Review Comment:
   It would be nice to break up this test and perform individual verification for each of the methods.



##########
indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Scopes;
+import com.google.inject.name.Names;
+import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
+import org.apache.druid.jackson.JacksonModule;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.executable.ExecutableValidator;
+import javax.validation.metadata.BeanDescriptor;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.Set;
+
+public class IndexingServiceTaskLogsModuleTest
+{
+
+  @Test
+  public void test_switchingTaskLogs_shouldUseDefaultWhenNoPusherConfigured()

Review Comment:
   ```suggestion
     public void test_switchingTaskLogs_usesDefaultType_whenNoPusherConfigured()
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2263217139


##########
indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Scopes;
+import com.google.inject.name.Names;
+import org.apache.druid.indexing.common.tasklogs.FileTaskLogs;
+import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs;
+import org.apache.druid.jackson.JacksonModule;
+import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.executable.ExecutableValidator;
+import javax.validation.metadata.BeanDescriptor;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.Set;
+
+public class IndexingServiceTaskLogsModuleTest
+{
+
+  @Test
+  public void test_switchingTaskLogs_shouldUseDefaultWhenNoPusherConfigured()
+  {
+    Properties props = new Properties();
+    props.setProperty("druid.indexer.logs.type", "switching");
+    props.setProperty("druid.indexer.logs.switching.defaultType", "file");
+
+    Injector injector = Guice.createInjector(
+        binder -> {
+          binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
+          binder.bind(Properties.class).toInstance(props);
+          binder.bind(Validator.class).toInstance(new MockValidator());

Review Comment:
   Not including these makes the test fail with
   
   ```
   1) [Guice/MissingImplementation]: No implementation for Validator was bound.
   
   Requested by:
   1  : JsonConfigurator.<init>(JsonConfigurator.java:84)
         \_ for 2nd parameter
        at JsonConfigProvider.inject(JsonConfigProvider.java:233)
         \_ for 2nd parameter
        at JsonConfigProvider.inject(JsonConfigProvider.java:233)
        at JsonConfigProvider.bind(JsonConfigProvider.java:151)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #18341:
URL: https://github.com/apache/druid/pull/18341#issuecomment-3174457903

   Thanks for fixing up the docker test job, @uds5501 !
   
   As a follow up to this PR, could you please take up the following:
   
   - Add docs for the new configs added here
   - Add a `Release note` section to the description of this PR
   - Add embedded tests for task logs


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2244545126


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   > druid.indexer.logs.switching.logsType=hdfs
   
   The options I am trying to provide here is different implementations of `logStorage` vs `logStreaming`, maybe I could just extend this to `druid.indexer.logs.switching.logs.storage` and `druid.indexer.logs.switching.streaming` ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259638061


##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -290,16 +298,83 @@ public RunnerStrategy get()
   private void configureTaskLogs(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, PROPERTY_PREFIX_SWITCHING + ".defaultType", Key.get(TaskLogs.class, Names.named("defaultType")), Key.get(FileTaskLogs.class));
+
     JsonConfigProvider.bind(binder, "druid.indexer.logs", FileTaskLogsConfig.class);
 
     final MapBinder<String, TaskLogs> taskLogBinder = Binders.taskLogsBinder(binder);
-    taskLogBinder.addBinding("noop").to(NoopTaskLogs.class).in(LazySingleton.class);
-    taskLogBinder.addBinding("file").to(FileTaskLogs.class).in(LazySingleton.class);
+
+    taskLogBinder.addBinding("switching").to(SwitchingTaskLogs.class);
+    Binders.bindTaskLogs(binder, "noop", NoopTaskLogs.class);
+    Binders.bindTaskLogs(binder, "file", FileTaskLogs.class);
+
     binder.bind(NoopTaskLogs.class).in(LazySingleton.class);
     binder.bind(FileTaskLogs.class).in(LazySingleton.class);
+    binder.bind(SwitchingTaskLogs.class).in(LazySingleton.class);
 
     binder.bind(TaskLogPusher.class).to(TaskLogs.class);
     binder.bind(TaskLogKiller.class).to(TaskLogs.class);
+    binder.bind(TaskPayloadManager.class).to(TaskLogs.class);

Review Comment:
   Removing these, this will happen directly via `IndexingServiceTaskLogsModule`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2263225964


##########
processing/src/main/java/org/apache/druid/guice/Binders.java:
##########
@@ -59,4 +60,16 @@ public static MapBinder<String, TaskLogs> taskLogsBinder(Binder binder)
   {
     return PolyBind.optionBinder(binder, Key.get(TaskLogs.class));
   }
+
+  /**
+   * Binds implementation of {@link TaskLogs} to the named keys for injection.
+   */
+  public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz)
+  {
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class)).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.reportType"))).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.streamType"))).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.pushType"))).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.defaultType"))).addBinding(type).to(clazz);

Review Comment:
   Oh, I see.
   
   You could just move `SwitchingTaskLogs` to the same package as `TaskLogs`.
   There is no reason it cannot be in `processing` module.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz merged PR #18341:
URL: https://github.com/apache/druid/pull/18341


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2244558306


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/ExternalTaskLogs.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.java.util.emitter.EmittingLogger;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ExternalTaskLogs implements TaskLogs
+{
+  private static final EmittingLogger log = new EmittingLogger(ExternalTaskLogs.class);
+  private final TaskLogs delegate;
+  private final ExternalLogStreamer logStreamer;
+
+  @Inject
+  public ExternalTaskLogs(@Named("delegate") TaskLogs delegate, ExternalLogStreamer logStreamer)
+  {
+    this.delegate = delegate;
+    this.logStreamer = logStreamer;
+  }
+
+  @Override
+  public Optional<InputStream> streamTaskLog(String taskid, long offset) throws IOException
+  {
+    return logStreamer.streamTaskLog(taskid, offset);
+  }
+
+  @Override
+  public Optional<InputStream> streamTaskReports(final String taskid) throws IOException
+  {
+    return delegate.streamTaskReports(taskid);
+  }
+
+  @Override
+  public Optional<InputStream> streamTaskStatus(final String taskid) throws IOException
+  {
+    return delegate.streamTaskReports(taskid);
+  }
+
+  @Override
+  public void pushTaskLog(String taskid, File logFile)
+  {
+    log.debug("Skipping task log push for task[%s]", taskid);

Review Comment:
   My thought was the base implementation for someone utilizing `external` log push type would not want to use the log pushes (otherwise I think they could use delegate itself?)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2244604082


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/ExternalTaskLogs.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import org.apache.druid.java.util.emitter.EmittingLogger;
+import org.apache.druid.tasklogs.TaskLogs;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ExternalTaskLogs implements TaskLogs
+{
+  private static final EmittingLogger log = new EmittingLogger(ExternalTaskLogs.class);
+  private final TaskLogs delegate;
+  private final ExternalLogStreamer logStreamer;
+
+  @Inject
+  public ExternalTaskLogs(@Named("delegate") TaskLogs delegate, ExternalLogStreamer logStreamer)
+  {
+    this.delegate = delegate;
+    this.logStreamer = logStreamer;
+  }
+
+  @Override
+  public Optional<InputStream> streamTaskLog(String taskid, long offset) throws IOException
+  {
+    return logStreamer.streamTaskLog(taskid, offset);
+  }
+
+  @Override
+  public Optional<InputStream> streamTaskReports(final String taskid) throws IOException
+  {
+    return delegate.streamTaskReports(taskid);
+  }
+
+  @Override
+  public Optional<InputStream> streamTaskStatus(final String taskid) throws IOException
+  {
+    return delegate.streamTaskReports(taskid);
+  }
+
+  @Override
+  public void pushTaskLog(String taskid, File logFile)
+  {
+    log.debug("Skipping task log push for task[%s]", taskid);

Review Comment:
   Yes, I agree. That is why the `external` + `delegate` combo confused me as well.
   
   I guess once we write out the `switching` implementation, the defaults would become clearer.
   But I feel that in any case, log pushing has been a default behaviour of Druid and we should not
   disable it by default even with the `switching` impl.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2247130151


##########
indexing-service/src/test/java/org/apache/druid/indexing/common/tasklogs/SwitchingTaskLogsTest.java:
##########
@@ -0,0 +1,332 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.common.tasklogs;
+
+import com.google.common.base.Optional;
+import com.google.common.io.ByteStreams;
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.tasklogs.TaskLogs;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class SwitchingTaskLogsTest
+{
+  private static final String TASK_ID = "testTask";
+  private static final String LOG_CONTENT = "test log content";
+  private static final String REPORT_CONTENT = "test report content";
+  private static final String STATUS_CONTENT = "test status content";
+  private static final String PAYLOAD_CONTENT = "test payload content";
+  private static final long OFFSET = 100L;
+  private static final long TIMESTAMP = 1234567890L;
+
+  @Mock
+  private TaskLogs delegateTaskLogs;
+
+  @Mock
+  private TaskLogs streamerTaskLogs;
+
+  @Mock
+  private TaskLogs pusherTaskLogs;
+
+  @Mock
+  private File testFile;
+
+  private SwitchingTaskLogs taskLogs;
+
+  @Before
+  public void setUp()
+  {
+    MockitoAnnotations.initMocks(this);

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking [MockitoAnnotations.initMocks](1) should be avoided because it has been deprecated.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/9940)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on PR #18341:
URL: https://github.com/apache/druid/pull/18341#issuecomment-3143726898

   I have verified the `noop` task streaming options in CLI Overlord. 
   
   Used the following configuration in embedded test setup to check the same -
   
   ```java
   overlord.addProperty("druid.indexer.task.default.context", "{\"useConcurrentLocks\": true}")
               .addProperty("druid.manager.segments.useIncrementalCache", "ifSynced")
               .addProperty("druid.manager.segments.pollDuration", "PT0.1s")
               .addProperty("druid.manager.segments.killUnused.enabled", "true")
               .addProperty("druid.manager.segments.killUnused.bufferPeriod", "PT0.1s")
               .addProperty("druid.manager.segments.killUnused.dutyPeriod", "PT1s")
               .addProperty("druid.indexer.logs.type", "switching")
               .addProperty("druid.indexer.logs.switching.defaultType", "file")
               .addProperty("druid.indexer.logs.switching.streamType", "noop");
   ```
   <img width="2299" height="1101" alt="image" src="https://github.com/user-attachments/assets/37a572a7-b3c9-44b7-80ec-7f3784c837b7" />
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2247332179


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   Using this combination noew.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2244931558


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   This sounds good, in my head I am looking to provide the flexibility just for log types for now. The `delegated` / `reportType` could take care of other task responsibilities. So finally, imo it should look like one of these.
   
   ### Option 1 [asking for explicit types for each responsibility]
   
   ```
   druid.indexer.logs.type=switching
   druid.indexer.logs.switching.reportsType=file
   druid.indexer.logs.switching.payloadManagerType=file
   druid.indexer.logs.switching.logsType=switching
   druid.indexer.logs.switching.logsType.logsPushType=noop
   druid.indexer.logs.switching.logsType.logsStreamType=file
   ```
   
   translating to
   
   ```java
   public class SwitchingTaskLogs implements TaskLogs
   {
     private final TaskLogs reportDelegate;
     private final TaskLogs payloadDelegate;
     private final TaskLogs logDelegate;
   
     @Inject
     public SwitchingTaskLogs(
         @Named("report") TaskLogs reportDelegate,
         @Named("payload") TaskLogs payloadDelegate,
         @Named("log") TaskLogs logDelegate
      )
     {
   
       this.reportDelegate = reportDelegate;
       this.payloadDelegate = payloadDelegate;
       this.logDelegate = logDelegate;
     }
   }
   
   public class TaskLogManager implements TaskLogs  // this / some flavour of switching task log will be injected as switching log delegate to handle the task related responsibilities with an appropriate factory placed in front.
   {
     private final TaskLogStreamer streamer;
     private final TaskLogPusher pusher; 
   
     @Inject
     public TaskLogManager(
         @Named("taskLogPusher") TaskLogs pusher,
         @Named("taskLogStreamer") TaskLogs streamer,
      )
     {
       this.pusher = pusher;
       this.streamer = streamer;
     }
   }
   ```
   
   or we could create one like 
   
   ### Option 2 [just keeping log handler separate while keeping the rest of the responsibilities with the delegate class]
   
   ```
   druid.indexer.logs.type=switching
   druid.indexer.logs.switching.delegate=file
   druid.indexer.logs.switching.logsHandlerType=switching
   druid.indexer.logs.switching.logHandler.logsPushType=noop
   druid.indexer.logs.switching.logHandler.logsStreamType=file
   ```
   
   ```java
   public class SwitchingTaskLogs implements TaskLogs
   {
     private final TaskLogs delegate;
     private final TaskLogs switchingLogDelegate; 
   
     @Inject
     public SwitchingTaskLogs(
         @Named("default") TaskLogs defaultDelegate,
         @Named("log") TaskLogs logDelegate,
      )
     {
       this.defaultDelegate = defaultDelegate;
       this.logDelegate = logDelegate;
     }
   }
   
   // the TaskLogManager stays the same.
   ```
   
   **I am personally leaning towards option 2 given the usecase in hand. what do you folks think?**
   
   <hr> 
   
   EDIT: managed to make it work with a single `SwitchingTaskLogs` with factory. I've added the implementation in this PR for the same.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259222993


##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -290,16 +298,83 @@ public RunnerStrategy get()
   private void configureTaskLogs(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, PROPERTY_PREFIX_SWITCHING + ".defaultType", Key.get(TaskLogs.class, Names.named("defaultType")), Key.get(FileTaskLogs.class));
+
     JsonConfigProvider.bind(binder, "druid.indexer.logs", FileTaskLogsConfig.class);
 
     final MapBinder<String, TaskLogs> taskLogBinder = Binders.taskLogsBinder(binder);
-    taskLogBinder.addBinding("noop").to(NoopTaskLogs.class).in(LazySingleton.class);
-    taskLogBinder.addBinding("file").to(FileTaskLogs.class).in(LazySingleton.class);
+
+    taskLogBinder.addBinding("switching").to(SwitchingTaskLogs.class);
+    Binders.bindTaskLogs(binder, "noop", NoopTaskLogs.class);
+    Binders.bindTaskLogs(binder, "file", FileTaskLogs.class);
+
     binder.bind(NoopTaskLogs.class).in(LazySingleton.class);
     binder.bind(FileTaskLogs.class).in(LazySingleton.class);
+    binder.bind(SwitchingTaskLogs.class).in(LazySingleton.class);
 
     binder.bind(TaskLogPusher.class).to(TaskLogs.class);
     binder.bind(TaskLogKiller.class).to(TaskLogs.class);
+    binder.bind(TaskPayloadManager.class).to(TaskLogs.class);

Review Comment:
   It does however the bindings here ensure you can use the switching implementation independent of the K8S task runnner



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2263222680


##########
processing/src/main/java/org/apache/druid/guice/Binders.java:
##########
@@ -59,4 +60,16 @@ public static MapBinder<String, TaskLogs> taskLogsBinder(Binder binder)
   {
     return PolyBind.optionBinder(binder, Key.get(TaskLogs.class));
   }
+
+  /**
+   * Binds implementation of {@link TaskLogs} to the named keys for injection.
+   */
+  public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz)
+  {
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class)).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.reportType"))).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.streamType"))).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.pushType"))).addBinding(type).to(clazz);
+    PolyBind.optionBinder(binder, Key.get(TaskLogs.class, Names.named("switching.defaultType"))).addBinding(type).to(clazz);

Review Comment:
   Using them here is causing a cyclic dependency.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2244484711


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   To ensure that extensions register themselves correctly as a valid type for say `druid.indexer.logs.switching.logsType`, you would need to add a utility method in `Binders`, say `bindTaskLogs` and invoke it from all the relevant extension modules.
   
   ```java
   public static <T extends TaskLogs> void bindTaskLogs(Binder binder, String type, Class<T> clazz) {
       // bind to `druid.indexer.logs.type`
       // bind to `druid.indexer.logs.switching.reportsType`
       // bind to `druid.indexer.logs.switching.logsType`
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2244569239


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   I see. Yes, the same `switching` concept can be extended for that use case as well.
   
   ```properties
   druid.indexer.logs.switching.streaming.logsPushType=noop
   druid.indexer.logs.switching.streaming.logsStreamType=file
   ```
   where `logsPushType` would bind to a `TaskLogPusher` object.
   and `logsStreamType` would bind to a `TaskLogStreamer` object.
   
   Would you still need to distinguish between reports and logs though?
   Because I assume reports might need to be pushed to a different place.
   If yes, you would still need a
   
   ```properties
   druid.indexer.logs.switching.streaming.reportsType=noop/file/hdfs
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2245216950


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   @uds5501 , I don't think we need two levels of a switching implementation. That would really complicate the configs.
   
   You can provide some decent defaults
   
   When `druid.indexer.logs.type=switching`
   
   |Property|Default|
   |---------|-------|
   |`druid.indexer.logs.switching.defaultType`|`file`|
   |`druid.indexer.logs.switching.logPushType`|use `defaultType`|
   |`druid.indexer.logs.switching.logStreamType`|use `defaultType`|
   |`druid.indexer.logs.switching.reportsType`|use `defaultType`|
   
   I don't think report and payload will ever need to be different.
   If needed, we can add it in the future.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2244931558


##########
indexing-service/src/main/java/org/apache/druid/guice/IndexingServiceTaskLogsModule.java:
##########
@@ -39,13 +42,22 @@ public class IndexingServiceTaskLogsModule implements Module
   public void configure(Binder binder)
   {
     PolyBind.createChoice(binder, "druid.indexer.logs.type", Key.get(TaskLogs.class), Key.get(FileTaskLogs.class));
+    PolyBind.createChoice(binder, "druid.indexer.logs.delegate.type", Key.get(TaskLogs.class, Names.named("delegate")), Key.get(FileTaskLogs.class));

Review Comment:
   This sounds good, in my head I am looking to provide the flexibility just for log types for now. The `delegated` / `reportType` could take care of other task responsibilities. So finally, imo it should look like one of these.
   
   ### Option 1 [asking for explicit types for each responsibility]
   
   ```
   druid.indexer.logs.type=switching
   druid.indexer.logs.switching.reportsType=file
   druid.indexer.logs.switching.payloadManagerType=file
   druid.indexer.logs.switching.logsHandlerType=switching
   druid.indexer.logs.switching.logHandler.logsPushType=noop
   druid.indexer.logs.switching.logHandler.logsStreamType=file
   ```
   
   translating to
   
   ```java
   public class SwitchingTaskLogs implements TaskLogs
   {
     private final TaskLogs reportDelegate;
     private final TaskLogs payloadDelegate;
     private final TaskLogs logDelegate;
   
     @Inject
     public SwitchingTaskLogs(
         @Named("report") TaskLogs reportDelegate,
         @Named("payload") TaskLogs payloadDelegate,
         @Named("log") TaskLogs logDelegate
      )
     {
   
       this.reportDelegate = reportDelegate;
       this.payloadDelegate = payloadDelegate;
       this.logDelegate = logDelegate;
     }
   }
   
   public class TaskLogManager implements TaskLogs  // this / some flavour of switching task log will be injected as switching log delegate to handle the task related responsibilities with an appropriate factory placed in front.
   {
     private final TaskLogStreamer streamer;
     private final TaskLogPusher pusher; 
   
     @Inject
     public TaskLogManager(
         @Named("taskLogPusher") TaskLogs pusher,
         @Named("taskLogStreamer") TaskLogs streamer,
      )
     {
       this.pusher = pusher;
       this.streamer = streamer;
     }
   }
   ```
   
   or we could create one like 
   
   ### Option 2 [just keeping log handler separate while keeping the rest of the responsibilities with the delegate class]
   
   ```
   druid.indexer.logs.type=switching
   druid.indexer.logs.switching.delegate=file
   druid.indexer.logs.switching.logsHandlerType=switching
   druid.indexer.logs.switching.logHandler.logsPushType=noop
   druid.indexer.logs.switching.logHandler.logsStreamType=file
   ```
   
   ```java
   public class SwitchingTaskLogs implements TaskLogs
   {
     private final TaskLogs delegate;
     private final TaskLogs switchingLogDelegate; 
   
     @Inject
     public SwitchingTaskLogs(
         @Named("default") TaskLogs defaultDelegate,
         @Named("log") TaskLogs logDelegate,
      )
     {
       this.defaultDelegate = defaultDelegate;
       this.logDelegate = logDelegate;
     }
   }
   
   // the TaskLogManager stays the same.
   ```
   
   **I am personally leaning towards option 2 given the usecase in hand. what do you folks think?**



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259207899


##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesOverlordModule.java:
##########
@@ -81,12 +85,16 @@
 public class KubernetesOverlordModule implements DruidModule
 {
 
-  private static final Logger log = new Logger(KubernetesOverlordModule.class);
+  private static final Logger log = new EmittingLogger(KubernetesOverlordModule.class);
   private static final String K8SANDWORKER_PROPERTIES_PREFIX = IndexingServiceModuleHelper.INDEXER_RUNNER_PROPERTY_PREFIX
                                                                + ".k8sAndWorker";
   private static final String RUNNERSTRATEGY_PROPERTIES_FORMAT_STRING = K8SANDWORKER_PROPERTIES_PREFIX
                                                                         + ".runnerStrategy.%s";
   private static final String HTTPCLIENT_PROPERITES_PREFIX = K8SANDWORKER_PROPERTIES_PREFIX + ".http";
+  private static final String PROPERTY_PREFIX_SWITCHING = "druid.indexer.logs.switching";
+  private static final String PROPERTY_KEY_SWITCHING_PUSH_TYPE = PROPERTY_PREFIX_SWITCHING + ".pushType";
+  private static final String PROPERTY_KEY_SWITCHING_STREAM_TYPE = PROPERTY_PREFIX_SWITCHING + ".streamType";
+  private static final String PROPERTY_KEY_SWITCHING_REPORTS_TYPE = PROPERTY_PREFIX_SWITCHING + ".reportsType";

Review Comment:
   These are binding related configs, should they be in the implementation class?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2259270396


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/config/FileTaskLogsConfig.java:
##########
@@ -19,11 +19,13 @@
 
 package org.apache.druid.indexing.common.config;
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 import javax.validation.constraints.NotNull;
 import java.io.File;
 
+@JsonIgnoreProperties(ignoreUnknown = true)

Review Comment:
   Oh, that might be because the `ObjectMapper` you used in the tests was not configured correctly.
   Typically, `configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);` does the trick.
   Try using the pre-baked `TestHelper.JSON_MAPPER` in the unit test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Making task log storage optional for Kubernetes Runner (druid)

Posted by "uds5501 (via GitHub)" <gi...@apache.org>.
uds5501 commented on code in PR #18341:
URL: https://github.com/apache/druid/pull/18341#discussion_r2262455397


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/config/FileTaskLogsConfig.java:
##########
@@ -19,11 +19,13 @@
 
 package org.apache.druid.indexing.common.config;
 
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 import javax.validation.constraints.NotNull;
 import java.io.File;
 
+@JsonIgnoreProperties(ignoreUnknown = true)

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org