nizhikov commented on a change in pull request #8937:
URL: https://github.com/apache/ignite/pull/8937#discussion_r604751663
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/MetricRegistry.java
##########
@@ -115,12 +116,17 @@ public void reset() {
}
/**
- * Register existing metrics in this group with the specified name.
+ * Register existing metrics in this group with the specified name. Note
that the name of the metric must
+ * start with the name of the current registry it is registered into.
*
* @param metric Metric.
*/
public void register(Metric metric) {
- addMetric(metric.name(), metric);
+ String mregPrefix = regName + SEPARATOR;
+
+ assert metric.name().startsWith(mregPrefix);
+
+ addMetric(metric.name().substring(mregPrefix.length()), metric);
Review comment:
I think we should guarantee correct creation of the metric somehow.
Please, see my comment below -
https://github.com/apache/ignite/pull/8937/files#r604746091
PS. assert should stay to check "hack" of the factory method with the
`IntMetric.create("", "MyMetric", "desc");`
--
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]