szetszwo commented on code in PR #742:
URL: https://github.com/apache/ratis/pull/742#discussion_r972083659
##########
ratis-server/src/main/java/org/apache/ratis/server/metrics/LeaderElectionMetrics.java:
##########
@@ -43,12 +44,20 @@ public final class LeaderElectionMetrics extends
RatisMetrics {
public static final String TRANSFER_LEADERSHIP_COUNT_METRIC =
"transferLeadershipCount";
public static final String LAST_LEADER_ELECTION_ELAPSED_TIME =
"lastLeaderElectionElapsedTime";
+
+ private final LongCounter electionCount =
getRegistry().counter(LEADER_ELECTION_COUNT_METRIC);
+ private final LongCounter timeoutCount =
getRegistry().counter(LEADER_ELECTION_TIMEOUT_COUNT_METRIC);
+ private final LongCounter transferLeadershipCount =
getRegistry().counter(TRANSFER_LEADERSHIP_COUNT_METRIC);
+
+ private final Timekeeper electionTime =
getRegistry().timer(LEADER_ELECTION_TIME_TAKEN);
+
private volatile Timestamp lastElectionTime;
private LeaderElectionMetrics(RaftGroupMemberId serverId, LongSupplier
getLastLeaderElapsedTimeMs) {
- this.registry = getMetricRegistryForLeaderElection(serverId);
- registry.gauge(LAST_LEADER_ELAPSED_TIME, () ->
getLastLeaderElapsedTimeMs::getAsLong);
- registry.gauge(LAST_LEADER_ELECTION_ELAPSED_TIME,
+ super(getMetricRegistryForLeaderElection(serverId));
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]