HBASE-17716 Formalize Scan Metric names

Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Karan Mehta 2017-03-06 18:18:09 -08:00 committed by Michael Stack
parent b635414e83
commit fee86ebd7b
3 changed files with 30 additions and 20 deletions

View File

@ -44,50 +44,60 @@ public class ScanMetrics extends ServerSideScanMetrics {
// ScannerCallable. They are atomic longs so that atomic getAndSet can be used to reset the
// values after progress is passed to hadoop's counters.
public static final String RPC_CALLS_METRIC_NAME = "RPC_CALLS";
public static final String REMOTE_RPC_CALLS_METRIC_NAME = "REMOTE_RPC_CALLS";
public static final String MILLIS_BETWEEN_NEXTS_METRIC_NAME = "MILLIS_BETWEEN_NEXTS";
public static final String NOT_SERVING_REGION_EXCEPTION_METRIC_NAME = "NOT_SERVING_REGION_EXCEPTION";
public static final String BYTES_IN_RESULTS_METRIC_NAME = "BYTES_IN_RESULTS";
public static final String BYTES_IN_REMOTE_RESULTS_METRIC_NAME = "BYTES_IN_REMOTE_RESULTS";
public static final String REGIONS_SCANNED_METRIC_NAME = "REGIONS_SCANNED";
public static final String RPC_RETRIES_METRIC_NAME = "RPC_RETRIES";
public static final String REMOTE_RPC_RETRIES_METRIC_NAME = "REMOTE_RPC_RETRIES";
/**
* number of RPC calls
*/
public final AtomicLong countOfRPCcalls = createCounter("RPC_CALLS");
public final AtomicLong countOfRPCcalls = createCounter(RPC_CALLS_METRIC_NAME);
/**
* number of remote RPC calls
*/
public final AtomicLong countOfRemoteRPCcalls = createCounter("REMOTE_RPC_CALLS");
public final AtomicLong countOfRemoteRPCcalls = createCounter(REMOTE_RPC_CALLS_METRIC_NAME);
/**
* sum of milliseconds between sequential next calls
*/
public final AtomicLong sumOfMillisSecBetweenNexts = createCounter("MILLIS_BETWEEN_NEXTS");
public final AtomicLong sumOfMillisSecBetweenNexts = createCounter(MILLIS_BETWEEN_NEXTS_METRIC_NAME);
/**
* number of NotServingRegionException caught
*/
public final AtomicLong countOfNSRE = createCounter("NOT_SERVING_REGION_EXCEPTION");
public final AtomicLong countOfNSRE = createCounter(NOT_SERVING_REGION_EXCEPTION_METRIC_NAME);
/**
* number of bytes in Result objects from region servers
*/
public final AtomicLong countOfBytesInResults = createCounter("BYTES_IN_RESULTS");
public final AtomicLong countOfBytesInResults = createCounter(BYTES_IN_RESULTS_METRIC_NAME);
/**
* number of bytes in Result objects from remote region servers
*/
public final AtomicLong countOfBytesInRemoteResults = createCounter("BYTES_IN_REMOTE_RESULTS");
public final AtomicLong countOfBytesInRemoteResults = createCounter(BYTES_IN_REMOTE_RESULTS_METRIC_NAME);
/**
* number of regions
*/
public final AtomicLong countOfRegions = createCounter("REGIONS_SCANNED");
public final AtomicLong countOfRegions = createCounter(REGIONS_SCANNED_METRIC_NAME);
/**
* number of RPC retries
*/
public final AtomicLong countOfRPCRetries = createCounter("RPC_RETRIES");
public final AtomicLong countOfRPCRetries = createCounter(RPC_RETRIES_METRIC_NAME);
/**
* number of remote RPC retries
*/
public final AtomicLong countOfRemoteRPCRetries = createCounter("REMOTE_RPC_RETRIES");
public final AtomicLong countOfRemoteRPCRetries = createCounter(REMOTE_RPC_RETRIES_METRIC_NAME);
/**
* constructor

View File

@ -48,19 +48,19 @@ public class ServerSideScanMetrics {
return c;
}
public static final String COUNT_OF_ROWS_SCANNED_KEY = "ROWS_SCANNED";
public static final String COUNT_OF_ROWS_FILTERED_KEY = "ROWS_FILTERED";
public static final String COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME = "ROWS_SCANNED";
public static final String COUNT_OF_ROWS_FILTERED_KEY_METRIC_NAME = "ROWS_FILTERED";
/**
* number of rows filtered during scan RPC
*/
public final AtomicLong countOfRowsFiltered = createCounter(COUNT_OF_ROWS_FILTERED_KEY);
public final AtomicLong countOfRowsFiltered = createCounter(COUNT_OF_ROWS_FILTERED_KEY_METRIC_NAME);
/**
* number of rows scanned during scan RPC. Not every row scanned will be returned to the client
* since rows may be filtered.
*/
public final AtomicLong countOfRowsScanned = createCounter(COUNT_OF_ROWS_SCANNED_KEY);
public final AtomicLong countOfRowsScanned = createCounter(COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME);
/**
* @param counterName

View File

@ -188,41 +188,41 @@ public class TestServerSideScanMetricsFromClientSide {
public void testRowsSeenMetric(Scan baseScan) throws Exception {
Scan scan;
scan = new Scan(baseScan);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY, NUM_ROWS);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, NUM_ROWS);
for (int i = 0; i < ROWS.length - 1; i++) {
scan = new Scan(baseScan);
scan.setStartRow(ROWS[0]);
scan.setStopRow(ROWS[i + 1]);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY, i + 1);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, i + 1);
}
for (int i = ROWS.length - 1; i > 0; i--) {
scan = new Scan(baseScan);
scan.setStartRow(ROWS[i - 1]);
scan.setStopRow(ROWS[ROWS.length - 1]);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY, ROWS.length - i);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length - i);
}
// The filter should filter out all rows, but we still expect to see every row.
Filter filter = new RowFilter(CompareOp.EQUAL, new BinaryComparator("xyz".getBytes()));
scan = new Scan(baseScan);
scan.setFilter(filter);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY, ROWS.length);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length);
// Filter should pass on all rows
SingleColumnValueFilter singleColumnValueFilter =
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.EQUAL, VALUE);
scan = new Scan(baseScan);
scan.setFilter(singleColumnValueFilter);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY, ROWS.length);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length);
// Filter should filter out all rows
singleColumnValueFilter =
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.NOT_EQUAL, VALUE);
scan = new Scan(baseScan);
scan.setFilter(singleColumnValueFilter);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY, ROWS.length);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length);
}
@Test
@ -305,7 +305,7 @@ public class TestServerSideScanMetricsFromClientSide {
throws Exception {
Scan scan = new Scan(baseScan);
if (filter != null) scan.setFilter(filter);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_FILTERED_KEY, expectedNumFiltered);
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_FILTERED_KEY_METRIC_NAME, expectedNumFiltered);
}
/**