Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ void snapshot(MetricsRecordBuilder mrb, boolean ignored) {
MetricsRegionSource.ROW_READS_ONLY_ON_MEMSTORE_DESC);
addGauge(mrb, tableWrapperAgg.getMixedRowReadsCount(tableName.getNameAsString()),
MetricsRegionSource.MIXED_ROW_READS, MetricsRegionSource.MIXED_ROW_READS_ON_STORE_DESC);
addGauge(mrb, tableWrapperAgg.getStoreFileSizePerStore(tableName.getNameAsString()),
MetricsRegionServerSource.STOREFILE_SIZE, MetricsRegionServerSource.STOREFILE_SIZE_DESC);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,7 @@ public interface MetricsTableWrapperAggregate {

/** Returns number of row reads from file and memstore per store for this table */
Map<String, Long> getMixedRowReadsCount(String table);

/** Returns store file size per store (column family) for this table */
Map<String, Long> getStoreFileSizePerStore(String table);
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,11 @@ public Map<String, Long> getMixedRowReadsCount(String table) {
map.put("table#info", 3L);
return map;
}

@Override
public Map<String, Long> getStoreFileSizePerStore(String table) {
Map<String, Long> map = new HashMap<String, Long>();
map.put("table#info", 2000L);
return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public void run() {
// accumulate the count
mt.perStoreMemstoreOnlyReadCount.put(tempKey, memstoreReadCount);
mt.perStoreMixedReadCount.put(tempKey, mixedReadCount);
mt.perStoreFileSize.merge(tempKey, store.getStorefilesSize(), Long::sum);
}

mt.regionCount += 1;
Expand Down Expand Up @@ -180,6 +181,16 @@ public Map<String, Long> getMixedRowReadsCount(String table) {
}
}

@Override
public Map<String, Long> getStoreFileSizePerStore(String table) {
MetricsTableValues metricsTable = metricsTableMap.get(TableName.valueOf(table));
if (metricsTable == null) {
return null;
} else {
return metricsTable.perStoreFileSize;
}
}

@Override
public long getCpRequestsCount(String table) {
MetricsTableValues metricsTable = metricsTableMap.get(TableName.valueOf(table));
Expand Down Expand Up @@ -443,6 +454,7 @@ private static class MetricsTableValues {
long cpRequestCount;
Map<String, Long> perStoreMemstoreOnlyReadCount = new HashMap<>();
Map<String, Long> perStoreMixedReadCount = new HashMap<>();
Map<String, Long> perStoreFileSize = new HashMap<>();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ public void testRegionAndStoreMetrics() throws IOException {
HELPER.assertCounter(pre + "bloomFilterEligibleRequestsCount", 444, agg);
}

@Test
public void testPerStoreFileSize() {
String perCfPre =
"Namespace_default_table_" + tableName + "_columnfamily_info_metric_storeFileSize";
HELPER.assertGauge(perCfPre, 2000, agg);
}

@Test
public void testFlush() {
rsm.updateFlush(tableName, 1, 2, 3);
Expand Down