HDFS-16181. [SBN Read] Fix display of JournalNode metric RpcRequestCacheMissAmount (#3317)

Co-authored-by: wangzhaohui8 <wangzhaohui8@jd.com>

(cherry picked from commit 232fd7cae170de8c6b52c14841a47dca8735c6d2)
(cherry picked from commit 2f73ac1c14dde86a5c0b86f9272cf98084478994)
(cherry picked from commit 928dbac0a627c5198b3d5884ef5a7dee3d975855)
(cherry picked from commit 9b63f601d3285c3885b2941c5874f225bfa9ab31)
This commit is contained in:
wangzhaohui 2021-09-16 00:56:51 +08:00 committed by Erik Krogen
parent edc138186f
commit 79c1a93bd7
2 changed files with 11 additions and 7 deletions

View File

@ -759,7 +759,7 @@ public GetJournaledEditsResponseProto getJournaledEdits(long sinceTxId,
.setEditLog(output.toByteString())
.build();
} catch (JournaledEditsCache.CacheMissException cme) {
metrics.rpcRequestCacheMissAmount.add(cme.getCacheMissAmount());
metrics.addRpcRequestCacheMissAmount(cme.getCacheMissAmount());
throw cme;
}
}

View File

@ -51,12 +51,7 @@ class JournalMetrics {
@Metric("Number of bytes served via RPC")
MutableCounterLong bytesServedViaRpc;
@Metric
MutableStat rpcRequestCacheMissAmount = new MutableStat(
"RpcRequestCacheMissAmount", "Number of RPC requests unable to be " +
"served due to lack of availability in cache, and how many " +
"transactions away the request was from being in the cache.",
"Misses", "Txns");
private MutableStat rpcRequestCacheMissAmount;
@Metric("Number of RPC requests with zero edits returned")
MutableCounterLong rpcEmptyResponses;
@ -84,6 +79,11 @@ class JournalMetrics {
"syncs" + interval + "s",
"Journal sync time", "ops", "latencyMicros", interval);
}
rpcRequestCacheMissAmount = registry
.newStat("RpcRequestCacheMissAmount", "Number of RPC requests unable to be " +
"served due to lack of availability in cache, and how many " +
"transactions away the request was from being in the cache.",
"Misses", "Txns");
}
public static JournalMetrics create(Journal j) {
@ -138,4 +138,8 @@ void addSync(long us) {
q.add(us);
}
}
public void addRpcRequestCacheMissAmount(long cacheMissAmount) {
rpcRequestCacheMissAmount.add(cacheMissAmount);
}
}