BUAAserein commented on code in PR #855:
URL: https://github.com/apache/ratis/pull/855#discussion_r1136662727
##########
ratis-server/src/main/java/org/apache/ratis/server/metrics/SegmentedRaftLogMetrics.java:
##########
@@ -155,8 +155,8 @@ public void onRaftLogAppendEntry() {
appendEntryCount.inc();
}
- public UncheckedAutoCloseable startAppendEntryTimer() {
- return Timekeeper.start(appendEntryTimer);
+ public Timekeeper getAppendEntryTimer() {
+ return appendEntryTimer;
Review Comment:
Done.
##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java:
##########
@@ -378,8 +378,8 @@ protected CompletableFuture<Long>
appendEntryImpl(LogEntryProto entry) {
if (LOG.isTraceEnabled()) {
LOG.trace("{}: appendEntry {}", getName(),
LogProtoUtils.toLogEntryString(entry));
}
- try(AutoCloseableLock writeLock = writeLock();
- UncheckedAutoCloseable ignored =
getRaftLogMetrics().startAppendEntryTimer()) {
+ try(AutoCloseableLock writeLock = writeLock()) {
+ Timekeeper.Context appendEntryTimerContext =
getRaftLogMetrics().getAppendEntryTimer().time();
Review Comment:
Done.
##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java:
##########
@@ -414,6 +414,11 @@ protected CompletableFuture<Long>
appendEntryImpl(LogEntryProto entry) {
} else {
cache.appendEntry(entry,
LogSegment.Op.WRITE_CACHE_WITHOUT_STATE_MACHINE_CACHE);
}
+ writeFuture.whenComplete((clientReply, exception) -> {
+ if (appendEntryTimerContext != null) {
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]