Search in sources :

Example 1 with RaftRole

use of com.hazelcast.cp.internal.raft.impl.RaftRole in project hazelcast by hazelcast.

the class RaftService method provideDynamicMetrics.

@Override
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) {
    MetricDescriptor rootDescriptor = descriptor.withPrefix(CP_PREFIX_RAFT_GROUP);
    for (Entry<CPGroupId, RaftNodeMetrics> entry : nodeMetrics.entrySet()) {
        CPGroupId groupId = entry.getKey();
        RaftRole role = entry.getValue().role;
        MetricDescriptor groupDescriptor = rootDescriptor.copy().withDiscriminator(CP_DISCRIMINATOR_GROUPID, String.valueOf(groupId.getId())).withTag(CP_TAG_NAME, groupId.getName()).withTag("role", role != null ? role.toString() : "NONE");
        context.collect(groupDescriptor, entry.getValue());
    }
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId) MetricDescriptor(com.hazelcast.internal.metrics.MetricDescriptor) RaftRole(com.hazelcast.cp.internal.raft.impl.RaftRole)

Aggregations

CPGroupId (com.hazelcast.cp.CPGroupId)1 RaftRole (com.hazelcast.cp.internal.raft.impl.RaftRole)1 MetricDescriptor (com.hazelcast.internal.metrics.MetricDescriptor)1