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 1aa88b2
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ 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 +244,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 @@ -640,14 +638,11 @@ public int get(PageId pageId, int pageOffset, int bytesToRead, ReadTargetBuffer
}
MultiDimensionalMetricsSystem.CACHED_DATA_READ.inc(bytesRead);
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_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 1aa88b2

Please sign in to comment.