suneet-s commented on code in PR #12802:
URL: https://github.com/apache/druid/pull/12802#discussion_r925536117


##########
server/src/main/java/org/apache/druid/server/metrics/MetricsModule.java:
##########
@@ -170,13 +174,41 @@ public JvmThreadsMonitor 
getJvmThreadsMonitor(DataSourceTaskIdHolder dataSourceT
   @Provides
   @ManageLifecycle
   public SysMonitor getSysMonitor(
-      DataSourceTaskIdHolder dataSourceTaskIdHolder
+      DataSourceTaskIdHolder dataSourceTaskIdHolder,
+      Injector injector
   )
   {
+    final Set<NodeRole> nodeRoles = getNodeRoles(injector);
     Map<String, String[]> dimensions = MonitorsConfig.mapOfDatasourceAndTaskID(
         dataSourceTaskIdHolder.getDataSource(),
         dataSourceTaskIdHolder.getTaskId()
     );
-    return new SysMonitor(dimensions);
+    return new SysMonitor(dimensions, isPeonRole(nodeRoles));

Review Comment:
   Instead of leaking `isPeon` into the SysMonitor - have you considered 
introducing a new class `NoopSysMonitor` that does nothing. Then in this 
provider  if the role is a Peon, return the noop class.
   
   I think that would be a cleaner division of responsibilities and it would 
make it easier to test as well.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to