Package org.apache.ignite.spi.communication.tcp

## Class TcpCommunicationMetricsListener

- java.lang.Object
- - org.apache.ignite.spi.communication.tcp.TcpCommunicationMetricsListener

-     public class TcpCommunicationMetricsListener
      extends Object

  Statistics for `TcpCommunicationSpi`.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TcpCommunicationMetricsListener​(Ignite ignite, IgniteSpiContext spiCtx)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected Map<UUID,​Long>` | `collectMessagesCountByNodeId​(String metricName)` | Collect messages count by nodeId
    `protected Map<String,​Long>` | `collectMessagesCountByType​(String prefix)` | Collect messages count by type
    `MetricRegistry` | `metricRegistry()` |
    `void` | `onMessageReceived​(Message msg, Object consistentId)` | Collects statistics for message received by SPI.
    `void` | `onMessageSent​(Message msg, Object consistentId)` | Collects statistics for message sent by SPI.
    `void` | `onNodeLeft​(Object consistentId)` |
    `long` | `receivedBytesCount()` | Gets received bytes count.
    `Map<UUID,​Long>` | `receivedMessagesByNode()` | Gets received messages counts (grouped by node).
    `Map<String,​Long>` | `receivedMessagesByType()` | Gets received messages counts (grouped by type).
    `static String` | `receivedMessagesByTypeMetricName​(Short directType)` | Generate metric name by message direct type id.
    `int` | `receivedMessagesCount()` | Gets received messages count.
    `void` | `resetMetrics()` | Resets metrics for this instance.
    `long` | `sentBytesCount()` | Gets sent bytes count.
    `Map<UUID,​Long>` | `sentMessagesByNode()` | Gets sent messages counts (grouped by node).
    `Map<String,​Long>` | `sentMessagesByType()` | Gets sent messages counts (grouped by type).
    `static String` | `sentMessagesByTypeMetricName​(Short directType)` | Generate metric name by message direct type id.
    `int` | `sentMessagesCount()` | Gets sent messages count.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TcpCommunicationMetricsListener

          public TcpCommunicationMetricsListener​(Ignite ignite,
                                                 IgniteSpiContext spiCtx)

      Parameters:
        `ignite` - Ignite instance.
        `spiCtx` - Ignite SPI context.

  - ### Method Detail

    - #### metricRegistry

          public MetricRegistry metricRegistry()

      Returns:
        Metrics registry.

    - #### onMessageSent

          public void onMessageSent​(Message msg,
                                    Object consistentId)

      Collects statistics for message sent by SPI.
      Parameters:
        `msg` - Sent message.
        `consistentId` - Receiver node consistent id.

    - #### onMessageReceived

          public void onMessageReceived​(Message msg,
                                        Object consistentId)

      Collects statistics for message received by SPI.
      Parameters:
        `msg` - Received message.
        `consistentId` - Sender node consistent id.

    - #### sentMessagesCount

          public int sentMessagesCount()

      Gets sent messages count.
      Returns:
        Sent messages count.

    - #### sentBytesCount

          public long sentBytesCount()

      Gets sent bytes count.
      Returns:
        Sent bytes count.

    - #### receivedMessagesCount

          public int receivedMessagesCount()

      Gets received messages count.
      Returns:
        Received messages count.

    - #### receivedBytesCount

          public long receivedBytesCount()

      Gets received bytes count.
      Returns:
        Received bytes count.

    - #### receivedMessagesByType

          public Map<String,​Long> receivedMessagesByType()

      Gets received messages counts (grouped by type).
      Returns:
        Map containing message types and respective counts.

    - #### receivedMessagesByNode

          public Map<UUID,​Long> receivedMessagesByNode()

      Gets received messages counts (grouped by node).
      Returns:
        Map containing sender nodes and respective counts.

    - #### sentMessagesByType

          public Map<String,​Long> sentMessagesByType()

      Gets sent messages counts (grouped by type).
      Returns:
        Map containing message types and respective counts.

    - #### sentMessagesByNode

          public Map<UUID,​Long> sentMessagesByNode()

      Gets sent messages counts (grouped by node).
      Returns:
        Map containing receiver nodes and respective counts.

    - #### collectMessagesCountByType

          protected Map<String,​Long> collectMessagesCountByType​(String prefix)

      Collect messages count by type

    - #### collectMessagesCountByNodeId

          protected Map<UUID,​Long> collectMessagesCountByNodeId​(String metricName)

      Collect messages count by nodeId

    - #### resetMetrics

          public void resetMetrics()

      Resets metrics for this instance.

    - #### onNodeLeft

          public void onNodeLeft​(Object consistentId)

      Parameters:
        `consistentId` - Consistent id of the node.

    - #### sentMessagesByTypeMetricName

          public static String sentMessagesByTypeMetricName​(Short directType)

      Generate metric name by message direct type id.
      Parameters:
        `directType` - Direct type ID of sent message.
      Returns:
        Metric name for sent message.

    - #### receivedMessagesByTypeMetricName

          public static String receivedMessagesByTypeMetricName​(Short directType)

      Generate metric name by message direct type id.
      Parameters:
        `directType` - Direct type ID of the received message.
      Returns:
        Metric name for the received message.