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 4a457174f01..17dd333e646 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 @@ -213,7 +213,9 @@ public void testGlobalPhoenixMetricsForQueries() throws Exception { assertTrue(GLOBAL_TASK_EXECUTION_TIME.getMetric().getValue() > 0); assertTrue(GLOBAL_HBASE_COUNT_RPC_CALLS.getMetric().getValue() > 0); - assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getValue() > 0); + // HBase adds whole milliseconds between scan calls. A short scan can finish in less + // than one millisecond, so the value can be zero. Check only that the scan records it. + assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getNumberOfSamples() > 0); assertTrue(GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS.getMetric().getValue() > 0); assertTrue(GLOBAL_HBASE_COUNT_SCANNED_REGIONS.getMetric().getValue() > 0); @@ -229,7 +231,9 @@ public void testGlobalPhoenixMetricsForMutations() throws Exception { assertEquals(10, GLOBAL_MUTATION_BATCH_SIZE.getMetric().getValue()); assertEquals(10, GLOBAL_MUTATION_SQL_COUNTER.getMetric().getValue()); assertTrue(GLOBAL_MUTATION_BYTES.getMetric().getValue() > 0); - assertTrue(GLOBAL_MUTATION_COMMIT_TIME.getMetric().getValue() > 0); + // The commit time has whole-millisecond resolution. A small commit can finish in less + // than one millisecond, so the value can be zero. Check only that the commit records it. + assertTrue(GLOBAL_MUTATION_COMMIT_TIME.getMetric().getNumberOfSamples() > 0); assertEquals(0, GLOBAL_NUM_PARALLEL_SCANS.getMetric().getValue()); assertEquals(0, GLOBAL_SELECT_SQL_COUNTER.getMetric().getValue()); assertEquals(0, GLOBAL_REJECTED_TASK_COUNTER.getMetric().getValue()); @@ -264,7 +268,9 @@ public void testGlobalPhoenixMetricsForUpsertSelect() throws Exception { assertEquals(0, GLOBAL_QUERY_TIME.getMetric().getValue()); assertTrue(GLOBAL_SCAN_BYTES.getMetric().getValue() > 0); assertTrue(GLOBAL_MUTATION_BYTES.getMetric().getValue() > 0); - assertTrue(GLOBAL_MUTATION_COMMIT_TIME.getMetric().getValue() > 0); + // The commit time has whole-millisecond resolution. A small commit can finish in less + // than one millisecond, so the value can be zero. Check only that the commit records it. + assertTrue(GLOBAL_MUTATION_COMMIT_TIME.getMetric().getNumberOfSamples() > 0); assertEquals(0, GLOBAL_SELECT_SQL_COUNTER.getMetric().getValue()); assertEquals(0, GLOBAL_REJECTED_TASK_COUNTER.getMetric().getValue()); assertEquals(0, GLOBAL_QUERY_TIMEOUT_COUNTER.getMetric().getValue()); @@ -274,7 +280,9 @@ public void testGlobalPhoenixMetricsForUpsertSelect() throws Exception { assertEquals(0, GLOBAL_MUTATION_INDEX_COMMIT_FAILURE_COUNT.getMetric().getValue()); assertTrue(GLOBAL_HBASE_COUNT_RPC_CALLS.getMetric().getValue() > 0); - assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getValue() > 0); + // HBase adds whole milliseconds between scan calls. A short scan can finish in less + // than one millisecond, so the value can be zero. Check only that the scan records it. + assertTrue(GLOBAL_HBASE_COUNT_MILLS_BETWEEN_NEXTS.getMetric().getNumberOfSamples() > 0); assertTrue(GLOBAL_HBASE_COUNT_BYTES_REGION_SERVER_RESULTS.getMetric().getValue() > 0); assertTrue(GLOBAL_HBASE_COUNT_SCANNED_REGIONS.getMetric().getValue() > 0);