Search in sources :

Example 1 with ClientEndpointStatisticsSnapshot

use of com.hazelcast.client.impl.ClientEndpointStatisticsSnapshot in project hazelcast by hazelcast.

the class ClientInfoCollector method forEachMetric.

@Override
public void forEachMetric(Node node, BiConsumer<PhoneHomeMetrics, String> metricsConsumer) {
    ClientEngine clientEngine = node.getClientEngine();
    Map<String, Long> activeClients = clientEngine.getActiveClientsInCluster();
    Map<String, ClientEndpointStatisticsSnapshot> snapshots = clientEngine.getEndpointStatisticsSnapshots();
    CLIENT_TYPE_TO_HELPER.forEach((clientType, helper) -> {
        long clientCount = activeClients.getOrDefault(clientType, 0L);
        ClientEndpointStatisticsSnapshot snapshot = snapshots.get(clientType);
        helper.collectMetrics(clientCount, snapshot, metricsConsumer);
    });
    metricsConsumer.accept(PhoneHomeMetrics.CLIENT_ENDPOINT_COUNT, MetricsCollector.convertToLetter(node.clientEngine.getClientEndpointCount()));
}
Also used : ClientEngine(com.hazelcast.client.impl.ClientEngine) ClientEndpointStatisticsSnapshot(com.hazelcast.client.impl.ClientEndpointStatisticsSnapshot)

Aggregations

ClientEndpointStatisticsSnapshot (com.hazelcast.client.impl.ClientEndpointStatisticsSnapshot)1 ClientEngine (com.hazelcast.client.impl.ClientEngine)1