Reamer commented on a change in pull request #3964:
URL: https://github.com/apache/zeppelin/pull/3964#discussion_r517854469



##########
File path: 
zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
##########
@@ -321,6 +326,21 @@ public void saveToFile() throws IOException {
     configStorage.save(info);
   }
 
+  private void initMetrics() {
+    // This class should  be a singleton
+    // Tests create more instances
+    Metrics.getMetricRegistry().removeMatching(
+      
MetricFilter.startsWith(MetricRegistry.name(METRICS_PREFIX_INTERPRETER)));
+    
Metrics.getMetricRegistry().<Gauge<Integer>>register(MetricRegistry.name(METRICS_PREFIX_INTERPRETER,
 "amount"),
+      interpreterSettings::size);
+    
Metrics.getMetricRegistry().<Gauge<Integer>>register(MetricRegistry.name(METRICS_PREFIX_INTERPRETER,
 "group", "size"),
+      () -> getAllInterpreterGroup().size());
+    for (Map.Entry<String, InterpreterSetting> interpreterSetting : 
interpreterSettings.entrySet()) {

Review comment:
       Not dynamic, we should register the metric when the interpreter is 
created and remove the registration when the interpreter is 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.

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


Reply via email to