Skip to content

Commit

Permalink
HBASE-27159 Emit source metrics for BlockCacheExpressHitPercent (#4830)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Purtell <[email protected]>
  • Loading branch information
d-c-manning authored Oct 17, 2022
1 parent 77a21b9 commit 5cacece
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,18 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String BLOCK_CACHE_HIT_COUNT_DESC = "Count of the hit on the block cache.";
String BLOCK_CACHE_PRIMARY_HIT_COUNT = "blockCacheHitCountPrimary";
String BLOCK_CACHE_PRIMARY_HIT_COUNT_DESC = "Count of hit on primary replica in the block cache.";
String BLOCK_CACHE_HIT_CACHING_COUNT = "blockCacheHitCachingCount";
String BLOCK_CACHE_HIT_CACHING_COUNT_DESC =
"Count of the hit on the block cache, for cacheable requests.";
String BLOCK_CACHE_MISS_COUNT = "blockCacheMissCount";
String BLOCK_COUNT_MISS_COUNT_DESC =
"Number of requests for a block that missed the block cache.";
String BLOCK_CACHE_PRIMARY_MISS_COUNT = "blockCacheMissCountPrimary";
String BLOCK_COUNT_PRIMARY_MISS_COUNT_DESC =
"Number of requests for a block of primary replica that missed the block cache.";
String BLOCK_CACHE_MISS_CACHING_COUNT = "blockCacheMissCachingCount";
String BLOCK_COUNT_MISS_CACHING_COUNT_DESC =
"Number of requests for a block that missed the block cache, for cacheable requests.";
String BLOCK_CACHE_EVICTION_COUNT = "blockCacheEvictionCount";
String BLOCK_CACHE_EVICTION_COUNT_DESC =
"Count of the number of blocks evicted from the block cache."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,16 @@ public void getMetrics(MetricsCollector metricsCollector, boolean all) {
rsWrap.getBlockCacheHitCount())
.addCounter(Interns.info(BLOCK_CACHE_PRIMARY_HIT_COUNT, BLOCK_CACHE_PRIMARY_HIT_COUNT_DESC),
rsWrap.getBlockCachePrimaryHitCount())
.addCounter(Interns.info(BLOCK_CACHE_HIT_CACHING_COUNT, BLOCK_CACHE_HIT_CACHING_COUNT_DESC),
rsWrap.getBlockCacheHitCachingCount())
.addCounter(Interns.info(BLOCK_CACHE_MISS_COUNT, BLOCK_COUNT_MISS_COUNT_DESC),
rsWrap.getBlockCacheMissCount())
.addCounter(
Interns.info(BLOCK_CACHE_PRIMARY_MISS_COUNT, BLOCK_COUNT_PRIMARY_MISS_COUNT_DESC),
rsWrap.getBlockCachePrimaryMissCount())
.addCounter(
Interns.info(BLOCK_CACHE_MISS_CACHING_COUNT, BLOCK_COUNT_MISS_CACHING_COUNT_DESC),
rsWrap.getBlockCacheMissCachingCount())
.addCounter(Interns.info(BLOCK_CACHE_EVICTION_COUNT, BLOCK_CACHE_EVICTION_COUNT_DESC),
rsWrap.getBlockCacheEvictedCount())
.addCounter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ public interface MetricsRegionServerWrapper {
*/
long getBlockCachePrimaryHitCount();

/**
* Get the count of hits to the block cache, for cacheable requests only.
*/
long getBlockCacheHitCachingCount();

/**
* Get the count of misses to the block cache.
*/
Expand All @@ -309,6 +314,11 @@ public interface MetricsRegionServerWrapper {
*/
long getBlockCachePrimaryMissCount();

/**
* Get the count of misses to the block cache, for cacheable requests only.
*/
long getBlockCacheMissCachingCount();

/**
* Get the number of items evicted from the block cache.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ public long getBlockCachePrimaryHitCount() {
return this.cacheStats != null ? this.cacheStats.getPrimaryHitCount() : 0L;
}

@Override
public long getBlockCacheHitCachingCount() {
return this.cacheStats != null ? this.cacheStats.getHitCachingCount() : 0L;
}

@Override
public long getBlockCacheMissCount() {
return this.cacheStats != null ? this.cacheStats.getMissCount() : 0L;
Expand All @@ -340,6 +345,11 @@ public long getBlockCachePrimaryMissCount() {
return this.cacheStats != null ? this.cacheStats.getPrimaryMissCount() : 0L;
}

@Override
public long getBlockCacheMissCachingCount() {
return this.cacheStats != null ? this.cacheStats.getMissCachingCount() : 0L;
}

@Override
public long getBlockCacheEvictedCount() {
return this.cacheStats != null ? this.cacheStats.getEvictedCount() : 0L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ public long getBlockCachePrimaryHitCount() {
return 422;
}

@Override
public long getBlockCacheHitCachingCount() {
return 16;
}

@Override
public long getBlockCacheMissCount() {
return 417;
Expand All @@ -342,6 +347,11 @@ public long getBlockCachePrimaryMissCount() {
return 421;
}

@Override
public long getBlockCacheMissCachingCount() {
return 17;
}

@Override
public long getBlockCacheEvictedCount() {
return 418;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ public void testWrapperSource() {
HELPER.assertGauge("blockCacheDataBlockCount", 300, serverSource);
HELPER.assertGauge("blockCacheSize", 415, serverSource);
HELPER.assertCounter("blockCacheHitCount", 416, serverSource);
HELPER.assertCounter("blockCacheHitCachingCount", 16, serverSource);
HELPER.assertCounter("blockCacheMissCount", 417, serverSource);
HELPER.assertCounter("blockCacheMissCachingCount", 17, serverSource);
HELPER.assertCounter("blockCacheEvictionCount", 418, serverSource);
HELPER.assertGauge("blockCacheCountHitPercent", 98, serverSource);
HELPER.assertGauge("blockCacheExpressHitPercent", 97, serverSource);
Expand Down

0 comments on commit 5cacece

Please sign in to comment.