File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
fluss-common/src/main/java/com/alibaba/fluss/metrics
fluss-server/src/main/java/com/alibaba/fluss/server/replica Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ public class MetricNames {
9797 // --------------------------------------------------------------------------------------------
9898
9999 // for replica
100+ public static final String UNDER_REPLICATED = "underReplicated" ;
100101 public static final String IN_SYNC_REPLICAS = "inSyncReplicasCount" ;
101102 public static final String UNDER_MIN_ISR = "underMinIsr" ;
102103 public static final String AT_MIN_ISR = "atMinIsr" ;
Original file line number Diff line number Diff line change @@ -244,6 +244,7 @@ public Replica(
244244 }
245245
246246 private void registerMetrics () {
247+ bucketMetricGroup .gauge (MetricNames .UNDER_REPLICATED , () -> isUnderReplicated () ? 1 : 0 );
247248 bucketMetricGroup .gauge (
248249 MetricNames .IN_SYNC_REPLICAS , () -> isLeader () ? isrState .isr ().size () : 0 );
249250 bucketMetricGroup .gauge (MetricNames .UNDER_MIN_ISR , () -> isUnderMinIsr () ? 1 : 0 );
@@ -1731,6 +1732,11 @@ private void validateInSyncReplicaSize(int requiredAcks) {
17311732 }
17321733 }
17331734
1735+ private boolean isUnderReplicated () {
1736+ // is leader and isr size less than numReplicas
1737+ return isLeader () && isrState .isr ().size () < tableConfig .getReplicationFactor ();
1738+ }
1739+
17341740 private boolean isUnderMinIsr () {
17351741 return isLeader () && isrState .isr ().size () < minInSyncReplicas ;
17361742 }
You can’t perform that action at this time.
0 commit comments