Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 c65c81a47 -> 10bdafb64
PHOENIX-4370 Surface hbase metrics from perconnection to global metrics Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/10bdafb6 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/10bdafb6 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/10bdafb6 Branch: refs/heads/4.x-HBase-1.1 Commit: 10bdafb64ee424e0e1728a151f0a28f702eddf77 Parents: c65c81a Author: ethan wang <ew...@apache.org> Authored: Wed Mar 14 14:05:30 2018 -0700 Committer: ethan wang <ew...@apache.org> Committed: Wed Mar 14 14:05:30 2018 -0700 ---------------------------------------------------------------------- .../phoenix/monitoring/PhoenixMetricsIT.java | 24 ++++++++++++++++- .../phoenix/iterate/ScanningResultIterator.java | 20 +++++++++++++++ .../phoenix/monitoring/GlobalClientMetrics.java | 27 ++++++++++++++++++-- 3 files changed, 68 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/10bdafb6/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java index 19afb96..e45ddcd 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java @@ -29,6 +29,19 @@ import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_SELECT_SQ import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_SPOOL_FILE_COUNTER; import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_TASK_END_TO_END_TIME; import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_TASK_EXECUTION_TIME; + +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_RPC_CALLS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_REMOTE_RPC_CALLS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_NOT_SERVING_REGION_EXCEPTION; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_BYTES_IN_REMOTE_RESULTS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_SCANNED_REGIONS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_RPC_RETRIES; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_REMOTE_RPC_RETRIES; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_ROWS_SCANNED; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_ROWS_FILTERED; + import static org.apache.phoenix.monitoring.MetricType.MEMORY_CHUNK_BYTES; import static org.apache.phoenix.monitoring.MetricType.SCAN_BYTES; import static org.apache.phoenix.monitoring.MetricType.TASK_EXECUTED_COUNTER; @@ -136,6 +149,11 @@ public class PhoenixMetricsIT extends BaseUniqueNamesOwnClusterIT { assertTrue(GLOBAL_QUERY_TIME.getMetric().getTotalSum() > 0); assertTrue(GLOBAL_TASK_END_TO_END_TIME.getMetric().getTotalSum() > 0); assertTrue(GLOBAL_TASK_EXECUTION_TIME.getMetric().getTotalSum() > 0); + + assertTrue(GLOBAL_HBASE_COUNT_RPC_CALLS.getMetric().getTotalSum() > 0); + assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getTotalSum() > 0); + assertTrue(GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS.getMetric().getTotalSum() > 0); + assertTrue(GLOBAL_HBASE_COUNT_SCANNED_REGIONS.getMetric().getTotalSum() > 0); } @Test @@ -181,6 +199,11 @@ public class PhoenixMetricsIT extends BaseUniqueNamesOwnClusterIT { assertEquals(0, GLOBAL_FAILED_QUERY_COUNTER.getMetric().getTotalSum()); assertEquals(0, GLOBAL_SPOOL_FILE_COUNTER.getMetric().getTotalSum()); assertEquals(0, GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getTotalSum()); + + assertTrue(GLOBAL_HBASE_COUNT_RPC_CALLS.getMetric().getTotalSum() > 0); + assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getTotalSum() > 0); + assertTrue(GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS.getMetric().getTotalSum() > 0); + assertTrue(GLOBAL_HBASE_COUNT_SCANNED_REGIONS.getMetric().getTotalSum() > 0); } private static void resetGlobalMetrics() { @@ -1075,5 +1098,4 @@ public class PhoenixMetricsIT extends BaseUniqueNamesOwnClusterIT { mutationReadMetricsMap.get(tableName1).size() > 0); protectedConn.close(); } - } http://git-wip-us.apache.org/repos/asf/phoenix/blob/10bdafb6/phoenix-core/src/main/java/org/apache/phoenix/iterate/ScanningResultIterator.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ScanningResultIterator.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ScanningResultIterator.java index bb70f8f..890dfcb 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ScanningResultIterator.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ScanningResultIterator.java @@ -18,6 +18,15 @@ package org.apache.phoenix.iterate; import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_SCAN_BYTES; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_RPC_CALLS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_REMOTE_RPC_CALLS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_NOT_SERVING_REGION_EXCEPTION; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_BYTES_IN_REMOTE_RESULTS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_SCANNED_REGIONS; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_RPC_RETRIES; +import static org.apache.phoenix.monitoring.GlobalClientMetrics.GLOBAL_HBASE_COUNT_REMOTE_RPC_RETRIES; import java.io.IOException; import java.sql.SQLException; @@ -101,6 +110,17 @@ public class ScanningResultIterator implements ResultIterator { scanMetricsMap.get(REMOTE_RPC_RETRIES_METRIC_NAME)); GLOBAL_SCAN_BYTES.update(scanMetricsMap.get(GLOBAL_BYTES_IN_RESULTS_METRIC_NAME)); + + GLOBAL_HBASE_COUNT_RPC_CALLS.update(scanMetricsMap.get(RPC_CALLS_METRIC_NAME)); + GLOBAL_HBASE_COUNT_REMOTE_RPC_CALLS.update(scanMetricsMap.get(REMOTE_RPC_CALLS_METRIC_NAME)); + GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.update(scanMetricsMap.get(MILLIS_BETWEEN_NEXTS_METRIC_NAME)); + GLOBAL_HBASE_COUNT_NOT_SERVING_REGION_EXCEPTION.update(scanMetricsMap.get(NOT_SERVING_REGION_EXCEPTION_METRIC_NAME)); + GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS.update(scanMetricsMap.get(BYTES_IN_RESULTS_METRIC_NAME)); + GLOBAL_HBASE_COUNT_BYTES_IN_REMOTE_RESULTS.update(scanMetricsMap.get(BYTES_IN_REMOTE_RESULTS_METRIC_NAME)); + GLOBAL_HBASE_COUNT_SCANNED_REGIONS.update(scanMetricsMap.get(REGIONS_SCANNED_METRIC_NAME)); + GLOBAL_HBASE_COUNT_RPC_RETRIES.update(scanMetricsMap.get(RPC_RETRIES_METRIC_NAME)); + GLOBAL_HBASE_COUNT_REMOTE_RPC_RETRIES.update(scanMetricsMap.get(REMOTE_RPC_RETRIES_METRIC_NAME)); + scanMetricsUpdated = true; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/10bdafb6/phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalClientMetrics.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalClientMetrics.java b/phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalClientMetrics.java index 08e4035..9c95895 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalClientMetrics.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalClientMetrics.java @@ -43,6 +43,18 @@ import static org.apache.phoenix.monitoring.MetricType.PHOENIX_CONNECTIONS_THROT import static org.apache.phoenix.monitoring.MetricType.PHOENIX_CONNECTIONS_ATTEMPTED_COUNTER; import static org.apache.phoenix.monitoring.MetricType.TASK_REJECTED_COUNTER; +import static org.apache.phoenix.monitoring.MetricType.COUNT_RPC_CALLS; +import static org.apache.phoenix.monitoring.MetricType.COUNT_REMOTE_RPC_CALLS; +import static org.apache.phoenix.monitoring.MetricType.COUNT_MILLS_BETWEEN_NEXTS; +import static org.apache.phoenix.monitoring.MetricType.COUNT_NOT_SERVING_REGION_EXCEPTION; +import static org.apache.phoenix.monitoring.MetricType.COUNT_BYTES_REGION_SERVER_RESULTS; +import static org.apache.phoenix.monitoring.MetricType.COUNT_BYTES_IN_REMOTE_RESULTS; +import static org.apache.phoenix.monitoring.MetricType.COUNT_SCANNED_REGIONS; +import static org.apache.phoenix.monitoring.MetricType.COUNT_RPC_RETRIES; +import static org.apache.phoenix.monitoring.MetricType.COUNT_REMOTE_RPC_RETRIES; +import static org.apache.phoenix.monitoring.MetricType.COUNT_ROWS_SCANNED; +import static org.apache.phoenix.monitoring.MetricType.COUNT_ROWS_FILTERED; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -58,7 +70,6 @@ import com.google.common.annotations.VisibleForTesting; */ public enum GlobalClientMetrics { - GLOBAL_MUTATION_BATCH_SIZE(MUTATION_BATCH_SIZE), GLOBAL_MUTATION_BYTES(MUTATION_BYTES), GLOBAL_MUTATION_COMMIT_TIME(MUTATION_COMMIT_TIME), @@ -83,7 +94,19 @@ public enum GlobalClientMetrics { GLOBAL_QUERY_SERVICES_COUNTER(QUERY_SERVICES_COUNTER), GLOBAL_HCONNECTIONS_COUNTER(HCONNECTIONS_COUNTER), GLOBAL_PHOENIX_CONNECTIONS_THROTTLED_COUNTER(PHOENIX_CONNECTIONS_THROTTLED_COUNTER), - GLOBAL_PHOENIX_CONNECTIONS_ATTEMPTED_COUNTER(PHOENIX_CONNECTIONS_ATTEMPTED_COUNTER); + GLOBAL_PHOENIX_CONNECTIONS_ATTEMPTED_COUNTER(PHOENIX_CONNECTIONS_ATTEMPTED_COUNTER), + + GLOBAL_HBASE_COUNT_RPC_CALLS(COUNT_RPC_CALLS), + GLOBAL_HBASE_COUNT_REMOTE_RPC_CALLS(COUNT_REMOTE_RPC_CALLS), + GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS(COUNT_MILLS_BETWEEN_NEXTS), + GLOBAL_HBASE_COUNT_NOT_SERVING_REGION_EXCEPTION(COUNT_NOT_SERVING_REGION_EXCEPTION), + GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS(COUNT_BYTES_REGION_SERVER_RESULTS), + GLOBAL_HBASE_COUNT_BYTES_IN_REMOTE_RESULTS(COUNT_BYTES_IN_REMOTE_RESULTS), + GLOBAL_HBASE_COUNT_SCANNED_REGIONS(COUNT_SCANNED_REGIONS), + GLOBAL_HBASE_COUNT_RPC_RETRIES(COUNT_RPC_RETRIES), + GLOBAL_HBASE_COUNT_REMOTE_RPC_RETRIES(COUNT_REMOTE_RPC_RETRIES), + GLOBAL_HBASE_COUNT_ROWS_SCANNED(COUNT_ROWS_SCANNED), + GLOBAL_HBASE_COUNT_ROWS_FILTERED(COUNT_ROWS_FILTERED); private static final boolean isGlobalMetricsEnabled = QueryServicesOptions.withDefaults().isGlobalMetricsEnabled();