Skip to content

Commit

Permalink
fix cache miss metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jja725 committed Sep 26, 2024
1 parent 6d99656 commit 099a045
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ public Optional<DataFileChannel> getDataFileChannel(
MetricsSystem.meter(MetricKey.CLIENT_CACHE_BYTES_READ_CACHE.getName()).mark(bytesToRead);
cacheContext.incrementCounter(MetricKey.CLIENT_CACHE_BYTES_READ_CACHE.getMetricName(), BYTE,
bytesToRead);
cacheContext.incrementCounter(
MetricKey.CLIENT_CACHE_PAGE_READ_CACHE_TIME_NS.getMetricName(), NANO,
System.nanoTime() - startTime);
LOG.debug("getDataChannel({},pageOffset={}) exits", pageId, pageOffset);
return Optional.of(dataFileChannel);
} catch (PageNotFoundException e) {
Expand All @@ -242,10 +245,6 @@ public Optional<DataFileChannel> getDataFileChannel(
return Optional.empty();
}
}
} finally {
cacheContext.incrementCounter(
MetricKey.CLIENT_CACHE_PAGE_READ_CACHE_TIME_NS.getMetricName(), NANO,
System.nanoTime() - startTime);
}
}

Expand Down Expand Up @@ -642,12 +641,10 @@ public int get(PageId pageId, int pageOffset, int bytesToRead, ReadTargetBuffer
MetricsSystem.meter(MetricKey.CLIENT_CACHE_BYTES_READ_CACHE.getName()).mark(bytesRead);
cacheContext.incrementCounter(MetricKey.CLIENT_CACHE_BYTES_READ_CACHE.getMetricName(), BYTE,
bytesRead);
cacheContext.incrementCounter(MetricKey.CLIENT_CACHE_PAGE_READ_CACHE_TIME_NS.getMetricName(),
NANO, System.nanoTime() - startTime);
LOG.debug("get({},pageOffset={}) exits", pageId, pageOffset);
return bytesRead;
} finally {
cacheContext.incrementCounter(
MetricKey.CLIENT_CACHE_PAGE_READ_CACHE_TIME_NS.getMetricName(), NANO,
System.nanoTime() - startTime);
}
}

Expand Down

0 comments on commit 099a045

Please sign in to comment.