use of org.apache.ignite.internal.managers.discovery.ClusterMetricsImpl in project ignite by apache.
the class SqlSystemViewsSelfTest method testDurationMetricsCanBeLonger24Hours.
/**
* Regression test. Verifies that duration metrics is able to be longer than 24 hours.
*/
@Test
public void testDurationMetricsCanBeLonger24Hours() throws Exception {
Ignite ign = startGrid("MockedMetrics", getConfiguration().setMetricsUpdateFrequency(500));
ClusterNode node = ign.cluster().localNode();
assert node instanceof TcpDiscoveryNode : "Setup failed, test is incorrect.";
// Get rid of metrics provider: current logic ignores metrics field if provider != null.
setField(node, "metricsProvider", null);
ClusterMetricsImpl original = getField(node, "metrics");
setField(node, "metrics", new MockedClusterMetrics(original));
;
List<?> durationMetrics = execSql(ign, "SELECT " + "MAX_JOBS_WAIT_TIME, " + "CUR_JOBS_WAIT_TIME, " + "AVG_JOBS_WAIT_TIME, " + "MAX_JOBS_EXECUTE_TIME, " + "CUR_JOBS_EXECUTE_TIME, " + "AVG_JOBS_EXECUTE_TIME, " + "TOTAL_JOBS_EXECUTE_TIME, " + "TOTAL_BUSY_TIME, " + "TOTAL_IDLE_TIME, " + "CUR_IDLE_TIME, " + "UPTIME " + "FROM " + systemSchemaName() + ".NODE_METRICS").get(0);
List<Long> elevenExpVals = LongStream.generate(() -> MockedClusterMetrics.LONG_DURATION_MS).limit(11).boxed().collect(Collectors.toList());
assertEqualsCollections(elevenExpVals, durationMetrics);
}
Aggregations