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


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/impl/MetricUtils.java:
##########
@@ -45,22 +47,43 @@ public class MetricUtils {
     /** Histogram name divider. */
     public static final char HISTOGRAM_NAME_DIVIDER = '_';
 
+    /** Custom metrics registry name. */
+    public static final String CUSTOM_METRICS = "custom";
+
+    /** Name prefix of a custom metric. */
+    public static final String CUSTOM_METRICS_PREF = CUSTOM_METRICS + 
SEPARATOR;
+
+    /** Custom metric name pattern. Permits empty string, spaces, tabs, dot at 
the start or end, consiquent dots. */
+    private static final Pattern CUSTOM_NAME_PATTERN = 
Pattern.compile("(?!\\.)(?!.*\\.$)(?!.*\\.\\.)(?!.*[\\s]+.*).+");
+
     /**
-     * Builds metric name. Each parameter will separated by '.' char.
+     * Chechs and builds metric name.
      *
      * @param names Metric name parts.
      * @return Metric name.
      */
     public static String metricName(String... names) {
-        assert names != null;
-        assert ensureAllNamesNotEmpty(names);
+        assert names != null && names.length > 0 : "Metric name must consist 
of at least one element.";
+
+        boolean custom = customMetric(names[0]);
 
-        if (names.length == 1)
-            return names[0];
+        for (int i = 0; i < names.length; i++) {

Review Comment:
   We need some custom name checks in `MetricRegistryImpl#register(...)`. There 
is no call of `customName()`



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