HBASE-17716 Formalize Scan Metric names
Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
parent
b635414e83
commit
fee86ebd7b
|
@ -44,50 +44,60 @@ public class ScanMetrics extends ServerSideScanMetrics {
|
||||||
// ScannerCallable. They are atomic longs so that atomic getAndSet can be used to reset the
|
// ScannerCallable. They are atomic longs so that atomic getAndSet can be used to reset the
|
||||||
// values after progress is passed to hadoop's counters.
|
// 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
|
* 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
|
* 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
|
* 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
|
* 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
|
* 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
|
* 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
|
* number of regions
|
||||||
*/
|
*/
|
||||||
public final AtomicLong countOfRegions = createCounter("REGIONS_SCANNED");
|
public final AtomicLong countOfRegions = createCounter(REGIONS_SCANNED_METRIC_NAME);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* number of RPC retries
|
* 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
|
* number of remote RPC retries
|
||||||
*/
|
*/
|
||||||
public final AtomicLong countOfRemoteRPCRetries = createCounter("REMOTE_RPC_RETRIES");
|
public final AtomicLong countOfRemoteRPCRetries = createCounter(REMOTE_RPC_RETRIES_METRIC_NAME);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
|
|
|
@ -48,19 +48,19 @@ public class ServerSideScanMetrics {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String COUNT_OF_ROWS_SCANNED_KEY = "ROWS_SCANNED";
|
public static final String COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME = "ROWS_SCANNED";
|
||||||
public static final String COUNT_OF_ROWS_FILTERED_KEY = "ROWS_FILTERED";
|
public static final String COUNT_OF_ROWS_FILTERED_KEY_METRIC_NAME = "ROWS_FILTERED";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* number of rows filtered during scan RPC
|
* 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
|
* number of rows scanned during scan RPC. Not every row scanned will be returned to the client
|
||||||
* since rows may be filtered.
|
* 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
|
* @param counterName
|
||||||
|
|
|
@ -188,41 +188,41 @@ public class TestServerSideScanMetricsFromClientSide {
|
||||||
public void testRowsSeenMetric(Scan baseScan) throws Exception {
|
public void testRowsSeenMetric(Scan baseScan) throws Exception {
|
||||||
Scan scan;
|
Scan scan;
|
||||||
scan = new Scan(baseScan);
|
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++) {
|
for (int i = 0; i < ROWS.length - 1; i++) {
|
||||||
scan = new Scan(baseScan);
|
scan = new Scan(baseScan);
|
||||||
scan.setStartRow(ROWS[0]);
|
scan.setStartRow(ROWS[0]);
|
||||||
scan.setStopRow(ROWS[i + 1]);
|
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--) {
|
for (int i = ROWS.length - 1; i > 0; i--) {
|
||||||
scan = new Scan(baseScan);
|
scan = new Scan(baseScan);
|
||||||
scan.setStartRow(ROWS[i - 1]);
|
scan.setStartRow(ROWS[i - 1]);
|
||||||
scan.setStopRow(ROWS[ROWS.length - 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.
|
// 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()));
|
Filter filter = new RowFilter(CompareOp.EQUAL, new BinaryComparator("xyz".getBytes()));
|
||||||
scan = new Scan(baseScan);
|
scan = new Scan(baseScan);
|
||||||
scan.setFilter(filter);
|
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
|
// Filter should pass on all rows
|
||||||
SingleColumnValueFilter singleColumnValueFilter =
|
SingleColumnValueFilter singleColumnValueFilter =
|
||||||
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.EQUAL, VALUE);
|
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.EQUAL, VALUE);
|
||||||
scan = new Scan(baseScan);
|
scan = new Scan(baseScan);
|
||||||
scan.setFilter(singleColumnValueFilter);
|
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
|
// Filter should filter out all rows
|
||||||
singleColumnValueFilter =
|
singleColumnValueFilter =
|
||||||
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.NOT_EQUAL, VALUE);
|
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.NOT_EQUAL, VALUE);
|
||||||
scan = new Scan(baseScan);
|
scan = new Scan(baseScan);
|
||||||
scan.setFilter(singleColumnValueFilter);
|
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
|
@Test
|
||||||
|
@ -305,7 +305,7 @@ public class TestServerSideScanMetricsFromClientSide {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
Scan scan = new Scan(baseScan);
|
Scan scan = new Scan(baseScan);
|
||||||
if (filter != null) scan.setFilter(filter);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue