From c72e69a8c8aff192a22f5f198e61722380832380 Mon Sep 17 00:00:00 2001 From: Arun Ramani <84351090+arunramani@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:14:41 -0700 Subject: [PATCH] MetricsModule: inject DataSourceTaskIdHolder early (#16140) * Explicitly bind ServiceStatusMonitor * Correct fix --- .../java/org/apache/druid/server/metrics/MetricsModule.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/apache/druid/server/metrics/MetricsModule.java b/server/src/main/java/org/apache/druid/server/metrics/MetricsModule.java index d486ae4fb8e..278a170910a 100644 --- a/server/src/main/java/org/apache/druid/server/metrics/MetricsModule.java +++ b/server/src/main/java/org/apache/druid/server/metrics/MetricsModule.java @@ -111,7 +111,10 @@ public class MetricsModule implements Module ) { List monitors = new ArrayList<>(); - + // HACK: when ServiceStatusMonitor is the first to be loaded, it introduces a circular dependency between + // CliPeon.runTask and CliPeon.getDataSourceFromTask/CliPeon.getTaskIDFromTask. The reason for this is unclear + // but by injecting DataSourceTaskIdHolder early this cycle is avoided. + injector.getInstance(DataSourceTaskIdHolder.class); for (Class monitorClass : Iterables.concat(monitorsConfig.getMonitors(), monitorSet)) { monitors.add(injector.getInstance(monitorClass)); }