nizhikov commented on code in PR #11293:
URL: https://github.com/apache/ignite/pull/11293#discussion_r1570437430


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java:
##########
@@ -745,4 +761,27 @@ private interface SunOperatingSystemMXBeanAccessor {
         /** @see 
com.sun.management.OperatingSystemMXBean#getTotalPhysicalMemorySize() */
         long getTotalPhysicalMemorySize();
     }
+
+    /** Custom metrics impl. */
+    private class CustomMetricsImpl implements IgniteMetrics {
+        /** {@inheritDoc} */
+        @Override public MetricRegistry getOrCreate(String registryName) {
+            return registry(customName(registryName));
+        }
+
+        /** {@inheritDoc} */
+        @Override public void remove(String registryName) {
+            GridMetricManager.this.remove(customName(registryName), false);
+        }
+
+        /** {@inheritDoc} */
+        @NotNull @Override public Iterator<ReadOnlyMetricRegistry> iterator() {
+            return F.viewReadOnly(registries.values(), r -> r, r -> 
MetricUtils.customMetric(r.name())).iterator();
+        }
+
+        /** Adds {@link MetricUtils#CUSTOM_METRICS} to {@code name}. */
+        private String customName(String name) {

Review Comment:
   Looks like `MetricUtils.customMetric` and `CustomMetricsImpl.customName` 
must be near each other.



-- 
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]

Reply via email to