use of org.apache.ignite.internal.processors.metric.impl.MetricUtils.SEPARATOR in project ignite by apache.
the class TcpCommunicationMetricsListener method collectMessagesCountByNodeId.
/**
* Collect messages count by nodeId
*/
protected Map<UUID, Long> collectMessagesCountByNodeId(String metricName) {
Map<UUID, Long> res = new HashMap<>();
Map<String, UUID> nodesMapping = ignite.cluster().nodes().stream().collect(toMap(node -> node.consistentId().toString(), ClusterNode::id));
String mregPrefix = COMMUNICATION_METRICS_GROUP_NAME + SEPARATOR;
for (ReadOnlyMetricRegistry mreg : spiCtx.metricRegistries()) {
if (mreg.name().startsWith(mregPrefix)) {
String nodeConsIdStr = mreg.name().substring(mregPrefix.length());
UUID nodeId = nodesMapping.get(nodeConsIdStr);
if (nodeId == null)
continue;
res.put(nodeId, mreg.<LongMetric>findMetric(metricName).value());
}
}
return res;
}
Aggregations