MetricsModule: inject DataSourceTaskIdHolder early (#16140)

* Explicitly bind ServiceStatusMonitor

* Correct fix
This commit is contained in:
Arun Ramani 2024-03-21 16:14:41 -07:00 committed by GitHub
parent 352902156a
commit c72e69a8c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -111,7 +111,10 @@ public class MetricsModule implements Module
)
{
List<Monitor> 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<? extends Monitor> monitorClass : Iterables.concat(monitorsConfig.getMonitors(), monitorSet)) {
monitors.add(injector.getInstance(monitorClass));
}