Search in sources :

Example 1 with LocalWanStats

use of com.hazelcast.monitor.LocalWanStats in project hazelcast by hazelcast.

the class MemberStateImpl method fromJson.

//CHECKSTYLE:OFF
@Override
public void fromJson(JsonObject json) {
    address = getString(json, "address");
    for (JsonObject.Member next : getObject(json, "mapStats")) {
        LocalMapStatsImpl stats = new LocalMapStatsImpl();
        stats.fromJson(next.getValue().asObject());
        mapStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "multiMapStats")) {
        LocalMultiMapStatsImpl stats = new LocalMultiMapStatsImpl();
        stats.fromJson(next.getValue().asObject());
        multiMapStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "replicatedMapStats", new JsonObject())) {
        LocalReplicatedMapStats stats = new LocalReplicatedMapStatsImpl();
        stats.fromJson(next.getValue().asObject());
        replicatedMapStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "queueStats")) {
        LocalQueueStatsImpl stats = new LocalQueueStatsImpl();
        stats.fromJson(next.getValue().asObject());
        queueStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "topicStats")) {
        LocalTopicStatsImpl stats = new LocalTopicStatsImpl();
        stats.fromJson(next.getValue().asObject());
        topicStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "executorStats")) {
        LocalExecutorStatsImpl stats = new LocalExecutorStatsImpl();
        stats.fromJson(next.getValue().asObject());
        executorStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "cacheStats", new JsonObject())) {
        LocalCacheStats stats = new LocalCacheStatsImpl();
        stats.fromJson(next.getValue().asObject());
        cacheStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "wanStats", new JsonObject())) {
        LocalWanStats stats = new LocalWanStatsImpl();
        stats.fromJson(next.getValue().asObject());
        wanStats.put(next.getName(), stats);
    }
    for (JsonObject.Member next : getObject(json, "runtimeProps")) {
        runtimeProps.put(next.getName(), next.getValue().asLong());
    }
    final JsonArray jsonClients = getArray(json, "clients");
    for (JsonValue jsonClient : jsonClients) {
        final ClientEndPointDTO client = new ClientEndPointDTO();
        client.fromJson(jsonClient.asObject());
        clients.add(client);
    }
    beans = new MXBeansDTO();
    beans.fromJson(getObject(json, "beans"));
    JsonObject jsonMemoryStats = getObject(json, "memoryStats", null);
    if (jsonMemoryStats != null) {
        memoryStats.fromJson(jsonMemoryStats);
    }
    JsonObject jsonOperationStats = getObject(json, "operationStats", null);
    if (jsonOperationStats != null) {
        operationStats.fromJson(jsonOperationStats);
    }
    JsonObject jsonMemberPartitionState = getObject(json, "memberPartitionState", null);
    if (jsonMemberPartitionState != null) {
        memberPartitionState = new MemberPartitionStateImpl();
        memberPartitionState.fromJson(jsonMemberPartitionState);
    }
    JsonObject jsonNodeState = getObject(json, "nodeState", null);
    if (jsonNodeState != null) {
        nodeState = new NodeStateImpl();
        nodeState.fromJson(jsonNodeState);
    }
    JsonObject jsonHotRestartState = getObject(json, "hotRestartState", null);
    if (jsonHotRestartState != null) {
        hotRestartState = new HotRestartStateImpl();
        hotRestartState.fromJson(jsonHotRestartState);
    }
    JsonObject jsonClusterHotRestartStatus = getObject(json, "clusterHotRestartStatus", null);
    if (jsonClusterHotRestartStatus != null) {
        clusterHotRestartStatus = new ClusterHotRestartStatusDTO();
        clusterHotRestartStatus.fromJson(jsonClusterHotRestartStatus);
    }
    JsonObject jsonWanSyncState = getObject(json, "wanSyncState", null);
    if (jsonWanSyncState != null) {
        wanSyncState = new WanSyncStateImpl();
        wanSyncState.fromJson(jsonWanSyncState);
    }
}
Also used : LocalCacheStats(com.hazelcast.monitor.LocalCacheStats) ClientEndPointDTO(com.hazelcast.internal.management.dto.ClientEndPointDTO) JsonValue(com.eclipsesource.json.JsonValue) JsonObject(com.eclipsesource.json.JsonObject) MXBeansDTO(com.hazelcast.internal.management.dto.MXBeansDTO) JsonArray(com.eclipsesource.json.JsonArray) LocalWanStats(com.hazelcast.monitor.LocalWanStats) ClusterHotRestartStatusDTO(com.hazelcast.internal.management.dto.ClusterHotRestartStatusDTO) LocalReplicatedMapStats(com.hazelcast.monitor.LocalReplicatedMapStats)

Example 2 with LocalWanStats

use of com.hazelcast.monitor.LocalWanStats in project hazelcast by hazelcast.

the class TimedMemberStateFactory method createMemState.

private void createMemState(TimedMemberState timedMemberState, MemberStateImpl memberState, Collection<StatisticsAwareService> services) {
    int count = 0;
    Config config = instance.getConfig();
    Set<String> longInstanceNames = new HashSet<String>(maxVisibleInstanceCount);
    for (StatisticsAwareService service : services) {
        if (count < maxVisibleInstanceCount) {
            if (service instanceof MapService) {
                count = handleMap(memberState, count, config, ((MapService) service).getStats(), longInstanceNames);
            } else if (service instanceof MultiMapService) {
                count = handleMultimap(memberState, count, config, ((MultiMapService) service).getStats(), longInstanceNames);
            } else if (service instanceof QueueService) {
                count = handleQueue(memberState, count, config, ((QueueService) service).getStats(), longInstanceNames);
            } else if (service instanceof TopicService) {
                count = handleTopic(memberState, count, config, ((TopicService) service).getStats(), longInstanceNames);
            } else if (service instanceof DistributedExecutorService) {
                count = handleExecutorService(memberState, count, config, ((DistributedExecutorService) service).getStats(), longInstanceNames);
            } else if (service instanceof ReplicatedMapService) {
                count = handleReplicatedMap(memberState, count, config, ((ReplicatedMapService) service).getStats(), longInstanceNames);
            }
        }
    }
    WanReplicationService wanReplicationService = instance.node.nodeEngine.getWanReplicationService();
    Map<String, LocalWanStats> wanStats = wanReplicationService.getStats();
    if (wanStats != null) {
        count = handleWan(memberState, count, wanStats, longInstanceNames);
    }
    if (cacheServiceEnabled) {
        ICacheService cacheService = getCacheService();
        for (CacheConfig cacheConfig : cacheService.getCacheConfigs()) {
            if (cacheConfig.isStatisticsEnabled() && count < maxVisibleInstanceCount) {
                CacheStatistics statistics = cacheService.getStatistics(cacheConfig.getNameWithPrefix());
                //is filled.git
                if (statistics != null) {
                    count = handleCache(memberState, count, cacheConfig, statistics, longInstanceNames);
                }
            }
        }
    }
    timedMemberState.setInstanceNames(longInstanceNames);
}
Also used : StatisticsAwareService(com.hazelcast.spi.StatisticsAwareService) CacheConfig(com.hazelcast.config.CacheConfig) Config(com.hazelcast.config.Config) GroupConfig(com.hazelcast.config.GroupConfig) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) QueueService(com.hazelcast.collection.impl.queue.QueueService) WanReplicationService(com.hazelcast.wan.WanReplicationService) CacheStatistics(com.hazelcast.cache.CacheStatistics) TopicService(com.hazelcast.topic.impl.TopicService) ICacheService(com.hazelcast.cache.impl.ICacheService) LocalWanStats(com.hazelcast.monitor.LocalWanStats) DistributedExecutorService(com.hazelcast.executor.impl.DistributedExecutorService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) MapService(com.hazelcast.map.impl.MapService) CacheConfig(com.hazelcast.config.CacheConfig) HashSet(java.util.HashSet)

Example 3 with LocalWanStats

use of com.hazelcast.monitor.LocalWanStats in project hazelcast by hazelcast.

the class TimedMemberStateFactory method handleWan.

private int handleWan(MemberStateImpl memberState, int count, Map<String, LocalWanStats> wans, Set<String> longInstanceNames) {
    for (Map.Entry<String, LocalWanStats> entry : wans.entrySet()) {
        String schemeName = entry.getKey();
        LocalWanStats stats = entry.getValue();
        memberState.putLocalWanStats(schemeName, stats);
        longInstanceNames.add("w:" + schemeName);
        count++;
    }
    return count;
}
Also used : LocalWanStats(com.hazelcast.monitor.LocalWanStats) Map(java.util.Map)

Example 4 with LocalWanStats

use of com.hazelcast.monitor.LocalWanStats in project hazelcast by hazelcast.

the class LocalWanStatsImplTest method testSerialization.

@Test
public void testSerialization() {
    LocalWanPublisherStatsImpl tokyo = new LocalWanPublisherStatsImpl();
    tokyo.setConnected(true);
    tokyo.incrementPublishedEventCount(10);
    tokyo.setOutboundQueueSize(100);
    LocalWanPublisherStatsImpl singapore = new LocalWanPublisherStatsImpl();
    singapore.setConnected(true);
    singapore.setOutboundQueueSize(200);
    singapore.incrementPublishedEventCount(20);
    LocalWanStatsImpl localWanStats = new LocalWanStatsImpl();
    Map<String, LocalWanPublisherStats> localWanPublisherStatsMap = new HashMap<String, LocalWanPublisherStats>();
    localWanPublisherStatsMap.put("tokyo", tokyo);
    localWanPublisherStatsMap.put("singapore", singapore);
    localWanStats.setLocalPublisherStatsMap(localWanPublisherStatsMap);
    JsonObject serialized = localWanStats.toJson();
    LocalWanStats deserialized = new LocalWanStatsImpl();
    deserialized.fromJson(serialized);
    LocalWanPublisherStats deserializedTokyo = deserialized.getLocalWanPublisherStats().get("tokyo");
    LocalWanPublisherStats deserializedSingapore = deserialized.getLocalWanPublisherStats().get("singapore");
    assertEquals(tokyo.isConnected(), deserializedTokyo.isConnected());
    assertEquals(tokyo.getTotalPublishedEventCount(), deserializedTokyo.getTotalPublishedEventCount());
    assertEquals(tokyo.getOutboundQueueSize(), deserializedTokyo.getOutboundQueueSize());
    assertEquals(tokyo.getTotalPublishLatency(), deserializedTokyo.getTotalPublishLatency());
    assertEquals(singapore.isConnected(), deserializedSingapore.isConnected());
    assertEquals(singapore.getTotalPublishedEventCount(), deserializedSingapore.getTotalPublishedEventCount());
    assertEquals(singapore.getOutboundQueueSize(), deserializedSingapore.getOutboundQueueSize());
    assertEquals(singapore.getTotalPublishLatency(), deserializedSingapore.getTotalPublishLatency());
}
Also used : LocalWanPublisherStats(com.hazelcast.monitor.LocalWanPublisherStats) HashMap(java.util.HashMap) LocalWanStats(com.hazelcast.monitor.LocalWanStats) JsonObject(com.eclipsesource.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

LocalWanStats (com.hazelcast.monitor.LocalWanStats)4 JsonObject (com.eclipsesource.json.JsonObject)2 JsonArray (com.eclipsesource.json.JsonArray)1 JsonValue (com.eclipsesource.json.JsonValue)1 CacheStatistics (com.hazelcast.cache.CacheStatistics)1 ICacheService (com.hazelcast.cache.impl.ICacheService)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 CacheConfig (com.hazelcast.config.CacheConfig)1 Config (com.hazelcast.config.Config)1 GroupConfig (com.hazelcast.config.GroupConfig)1 DistributedExecutorService (com.hazelcast.executor.impl.DistributedExecutorService)1 ClientEndPointDTO (com.hazelcast.internal.management.dto.ClientEndPointDTO)1 ClusterHotRestartStatusDTO (com.hazelcast.internal.management.dto.ClusterHotRestartStatusDTO)1 MXBeansDTO (com.hazelcast.internal.management.dto.MXBeansDTO)1 MapService (com.hazelcast.map.impl.MapService)1 LocalCacheStats (com.hazelcast.monitor.LocalCacheStats)1 LocalReplicatedMapStats (com.hazelcast.monitor.LocalReplicatedMapStats)1 LocalWanPublisherStats (com.hazelcast.monitor.LocalWanPublisherStats)1 MultiMapService (com.hazelcast.multimap.impl.MultiMapService)1 ReplicatedMapService (com.hazelcast.replicatedmap.impl.ReplicatedMapService)1