Skip to content
Open
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 @@ -209,6 +209,11 @@ public void testGlobalPhoenixMetricsForQueries() throws Exception {

assertTrue(GLOBAL_SCAN_BYTES.getMetric().getValue() > 0);
assertTrue(GLOBAL_QUERY_TIME.getMetric().getValue() > 0);
// The pool thread records the task times after it gives the scan result to the client.
// Wait until it records them.
getUtility().waitFor(10000, 10,
() -> GLOBAL_TASK_END_TO_END_TIME.getMetric().getNumberOfSamples() > 0
&& GLOBAL_TASK_EXECUTION_TIME.getMetric().getNumberOfSamples() > 0);
assertTrue(GLOBAL_TASK_END_TO_END_TIME.getMetric().getValue() > 0);
assertTrue(GLOBAL_TASK_EXECUTION_TIME.getMetric().getValue() > 0);

Expand Down Expand Up @@ -1079,6 +1084,21 @@ private void changeInternalStateForTesting(PhoenixResultSet rs) throws NoSuchFie
private void assertReadMetricValuesForSelectSql(ArrayList<Long> numRows,
ArrayList<Long> numExpectedTasks, PhoenixResultSet resultSetBeingTested,
Set<String> expectedTableNames) throws SQLException {
// The pool threads record the task times after they give the scan results to the client.
// Wait until each task records its time. The checks below then find any wrong value.
getUtility().waitFor(10000, 10, () -> {
for (Map<MetricType, Long> m : PhoenixRuntime.getRequestReadMetricInfo(resultSetBeingTested)
.values()) {
Long numTasks = m.get(TASK_EXECUTED_COUNTER);
Long taskTime = m.get(TASK_EXECUTION_TIME);
if (
numTasks == null || taskTime == null || taskTime < numTasks * TASK_EXECUTION_TIME_DELTA
) {
return false;
}
}
return true;
});
Map<String, Map<MetricType, Long>> metrics =
PhoenixRuntime.getRequestReadMetricInfo(resultSetBeingTested);
int counter = 0;
Expand Down
Loading