Search in sources :

Example 1 with SEPARATOR

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;
}
Also used : IgniteSpiContext(org.apache.ignite.spi.IgniteSpiContext) Metric(org.apache.ignite.spi.metric.Metric) RECEIVED_MESSAGES_METRIC_DESC(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.RECEIVED_MESSAGES_METRIC_DESC) IntMap(org.apache.ignite.internal.util.collection.IntMap) RECEIVED_MESSAGES_METRIC_NAME(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.RECEIVED_MESSAGES_METRIC_NAME) HashMap(java.util.HashMap) Function(java.util.function.Function) RECEIVED_MESSAGES_BY_TYPE_METRIC_DESC(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.RECEIVED_MESSAGES_BY_TYPE_METRIC_DESC) ClusterNode(org.apache.ignite.cluster.ClusterNode) Collectors.toMap(java.util.stream.Collectors.toMap) LongAdderMetric(org.apache.ignite.internal.processors.metric.impl.LongAdderMetric) SENT_BYTES_METRIC_DESC(org.apache.ignite.internal.util.nio.GridNioServer.SENT_BYTES_METRIC_DESC) Map(java.util.Map) IgniteMessageFactoryImpl(org.apache.ignite.internal.managers.communication.IgniteMessageFactoryImpl) MetricUtils.metricName(org.apache.ignite.internal.processors.metric.impl.MetricUtils.metricName) SENT_MESSAGES_BY_TYPE_METRIC_NAME(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.SENT_MESSAGES_BY_TYPE_METRIC_NAME) RECEIVED_MESSAGES_BY_TYPE_METRIC_NAME(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.RECEIVED_MESSAGES_BY_TYPE_METRIC_NAME) SEPARATOR(org.apache.ignite.internal.processors.metric.impl.MetricUtils.SEPARATOR) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC) SENT_MESSAGES_BY_TYPE_METRIC_DESC(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.SENT_MESSAGES_BY_TYPE_METRIC_DESC) UUID(java.util.UUID) Ignite(org.apache.ignite.Ignite) SENT_BYTES_METRIC_NAME(org.apache.ignite.internal.util.nio.GridNioServer.SENT_BYTES_METRIC_NAME) MetricRegistry(org.apache.ignite.internal.processors.metric.MetricRegistry) GridIoMessage(org.apache.ignite.internal.managers.communication.GridIoMessage) COMMUNICATION_METRICS_GROUP_NAME(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.COMMUNICATION_METRICS_GROUP_NAME) IgniteBiTuple(org.apache.ignite.lang.IgniteBiTuple) ReadOnlyMetricRegistry(org.apache.ignite.spi.metric.ReadOnlyMetricRegistry) RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME) RECEIVED_BYTES_METRIC_NAME(org.apache.ignite.internal.util.nio.GridNioServer.RECEIVED_BYTES_METRIC_NAME) SENT_MESSAGES_METRIC_NAME(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.SENT_MESSAGES_METRIC_NAME) RECEIVED_BYTES_METRIC_DESC(org.apache.ignite.internal.util.nio.GridNioServer.RECEIVED_BYTES_METRIC_DESC) SENT_MESSAGES_METRIC_DESC(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.SENT_MESSAGES_METRIC_DESC) IgniteMessageFactory(org.apache.ignite.plugin.extensions.communication.IgniteMessageFactory) Message(org.apache.ignite.plugin.extensions.communication.Message) SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC) IntHashMap(org.apache.ignite.internal.util.collection.IntHashMap) LongMetric(org.apache.ignite.spi.metric.LongMetric) Collections(java.util.Collections) SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) IntHashMap(org.apache.ignite.internal.util.collection.IntHashMap) ReadOnlyMetricRegistry(org.apache.ignite.spi.metric.ReadOnlyMetricRegistry) LongMetric(org.apache.ignite.spi.metric.LongMetric) UUID(java.util.UUID)

Aggregations

Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 UUID (java.util.UUID)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Function (java.util.function.Function)1 Collectors.toMap (java.util.stream.Collectors.toMap)1 Ignite (org.apache.ignite.Ignite)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 GridIoMessage (org.apache.ignite.internal.managers.communication.GridIoMessage)1 IgniteMessageFactoryImpl (org.apache.ignite.internal.managers.communication.IgniteMessageFactoryImpl)1 MetricRegistry (org.apache.ignite.internal.processors.metric.MetricRegistry)1 LongAdderMetric (org.apache.ignite.internal.processors.metric.impl.LongAdderMetric)1 SEPARATOR (org.apache.ignite.internal.processors.metric.impl.MetricUtils.SEPARATOR)1 MetricUtils.metricName (org.apache.ignite.internal.processors.metric.impl.MetricUtils.metricName)1 IntHashMap (org.apache.ignite.internal.util.collection.IntHashMap)1 IntMap (org.apache.ignite.internal.util.collection.IntMap)1 RECEIVED_BYTES_METRIC_DESC (org.apache.ignite.internal.util.nio.GridNioServer.RECEIVED_BYTES_METRIC_DESC)1 RECEIVED_BYTES_METRIC_NAME (org.apache.ignite.internal.util.nio.GridNioServer.RECEIVED_BYTES_METRIC_NAME)1