tjiuming commented on code in PR #17041:
URL: https://github.com/apache/pulsar/pull/17041#discussion_r943693887
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java:
##########
@@ -235,10 +239,20 @@ public <T> MetadataCache<T>
getMetadataCache(MetadataSerde<T> serde) {
@Override
public CompletableFuture<Optional<GetResult>> get(String path) {
+ long start = System.currentTimeMillis();
if (!isValidPath(path)) {
- return FutureUtil.failedFuture(new
MetadataStoreException.InvalidPathException(path));
+ stats.recordGetOpsFailed();
+ return FutureUtil
+ .failedFuture(new
MetadataStoreException.InvalidPathException(path));
}
- return storeGet(path);
+ return storeGet(path)
+ .whenComplete((v, t) -> {
+ if (t != null) {
+ stats.recordGetOpsFailed();
+ } else {
+ stats.recordGetOpsLatency(System.currentTimeMillis() -
start);
Review Comment:
latency record ops's latency, but `recordGetOpsFailed ` the times of failed
ops. I think no need to keep consistent.
--
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]