Search in sources :

Example 1 with ClusterMetricsImpl

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);
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) ClusterMetricsImpl(org.apache.ignite.internal.managers.discovery.ClusterMetricsImpl) Ignite(org.apache.ignite.Ignite) TcpDiscoveryNode(org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode) AbstractIndexingCommonTest(org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest) AbstractSchemaSelfTest(org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest) Test(org.junit.Test)

Aggregations

Ignite (org.apache.ignite.Ignite)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 ClusterMetricsImpl (org.apache.ignite.internal.managers.discovery.ClusterMetricsImpl)1 AbstractIndexingCommonTest (org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest)1 AbstractSchemaSelfTest (org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest)1 TcpDiscoveryNode (org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode)1 Test (org.junit.Test)1