Class JGroupsRaftMetrics.DisabledJGroupsRaftMetrics

java.lang.Object
org.jgroups.raft.JGroupsRaftMetrics.DisabledJGroupsRaftMetrics
All Implemented Interfaces:
JGroupsRaftMetrics
Enclosing interface:
JGroupsRaftMetrics

public static final class JGroupsRaftMetrics.DisabledJGroupsRaftMetrics extends Object implements JGroupsRaftMetrics
Since:
2.0
Author:
José Bolina
  • Method Details

    • getTotalNodes

      public int getTotalNodes()
      Description copied from interface: JGroupsRaftMetrics
      The total number of nodes configured in the cluster, excluding learners.

      This value reflects the static Raft membership. The member in the list include only the voting members of the algorithm. This list reflects the currently configured members, and as such, it only changes through membership operation submitted through JGroupsRaftAdministration. The JGroupsRaftMetrics.getActiveNodes() returns a live view of the cluster members.

      Specified by:
      getTotalNodes in interface JGroupsRaftMetrics
      Returns:
      the configured cluster size, or -1 if metrics are disabled.
    • getActiveNodes

      public int getActiveNodes()
      Description copied from interface: JGroupsRaftMetrics
      The number of nodes currently reachable in the cluster view.

      Compare this value against JGroupsRaftMetrics.getTotalNodes() to detect membership degradation. When active nodes drop below the majority threshold (totalNodes / 2 + 1), the cluster becomes unavailable until enough members rejoin. Monitoring this metric is essential for alerting on availability risks before the cluster loses quorum.

      Specified by:
      getActiveNodes in interface JGroupsRaftMetrics
      Returns:
      the number of active nodes (including learners), or -1 if metrics are disabled.
    • leaderMetrics

      public ElectionMetrics leaderMetrics()
      Description copied from interface: JGroupsRaftMetrics
      Metrics about the current leader and election timing.

      Use these metrics to identify the current leader, determine when the last election occurred, and detect leadership instability. Frequent leader changes may indicate network issues or misconfigured failure detectors, and each election causes a brief period where operations are unavailable.

      Specified by:
      leaderMetrics in interface JGroupsRaftMetrics
      Returns:
      the leader election metrics; never null.
      See Also:
    • replicationMetrics

      public LogMetrics replicationMetrics()
      Description copied from interface: JGroupsRaftMetrics
      Metrics about the Raft log, including entry counts and replication progress.

      Use these metrics to monitor replication health. A growing gap between total and replicated entries indicates that followers are falling behind.

      Specified by:
      replicationMetrics in interface JGroupsRaftMetrics
      Returns:
      the log replication metrics; never null.
      See Also:
    • performanceMetrics

      public PerformanceMetrics performanceMetrics()
      Description copied from interface: JGroupsRaftMetrics
      Latency measurements for the main operations: request processing, consensus, leader election, and request forwarding.

      Use these metrics to identify performance bottlenecks and validate SLAs. Comparing the different latency categories helps pinpoint whether delays originate from consensus, request queuing, or network forwarding. See PerformanceMetrics for details on each category.

      Specified by:
      performanceMetrics in interface JGroupsRaftMetrics
      Returns:
      the performance metrics; never null.
      See Also:
    • reset

      public void reset()
      Description copied from interface: JGroupsRaftMetrics
      Resets all collected metrics to their initial state.

      Clears latency histograms, counters, and any accumulated statistics across all metric categories (election, log, performance). Membership metrics (JGroupsRaftMetrics.getTotalNodes(), JGroupsRaftMetrics.getActiveNodes()) are not affected since they reflect live cluster state rather than accumulated measurements.

      This is useful for establishing a clean baseline after configuration changes, deployments, or when investigating a specific time window. Has no effect when metrics are disabled.

      Specified by:
      reset in interface JGroupsRaftMetrics