nizhikov commented on a change in pull request #6814: IGNITE-12108 TCP
Communication Metrics ported to a new framework.
URL: https://github.com/apache/ignite/pull/6814#discussion_r364854622
##########
File path:
modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationMetricsListener.java
##########
@@ -247,10 +278,55 @@ public long receivedBytesCount() {
* @return Map containing receiver nodes and respective counts.
*/
public Map<UUID, Long> sentMessagesByNode() {
+ return
collectMessagesCountByNodeId(SENT_MESSAGES_BY_NODE_ID_METRIC_NAME);
+ }
+
+ /** */
+ protected Map<String, Long> collectMessagesCountByType(String prefix) {
+ Map<String, Long> res = new HashMap<>();
+
+ prefix = MetricUtils.metricName(COMMUNICATION_METRICS_GROUP_NAME,
prefix);
+
+ for (Metric metric : mreg) {
+ if (metric.name().startsWith(prefix)) {
+ try {
+ short directType =
Short.parseShort(metric.name().substring(prefix.length()));
+
+ Map<Short, String> msgTypMap0 = msgTypMap;
+
+ if (msgTypMap0 != null) {
+ String typeName = msgTypMap0.get(directType);
+
+ if (typeName != null)
+ res.put(typeName, ((LongMetric)metric).value());
+ }
+ }
+ catch (NumberFormatException ignore) {
+ }
+ }
+ }
+
+ return res;
+ }
+
+ /** */
+ protected Map<UUID, Long> collectMessagesCountByNodeId(String metricName) {
Map<UUID, Long> res = new HashMap<>();
- for (ThreadMetrics metrics : allMetrics)
- addMetrics(res, metrics.sentMsgsCntByNode);
+ String mregPrefix = COMMUNICATION_METRICS_GROUP_NAME +
MetricUtils.SEPARATOR;
+ for (MetricRegistry mreg : mmgr) {
Review comment:
empty line required
----------------------------------------------------------------
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]
With regards,
Apache Git Services