Search in sources :

Example 1 with CQLMetrics

use of org.apache.cassandra.metrics.CQLMetrics in project cassandra by apache.

the class CQLMetricsTableTest method testUsingInjectedValues.

@Test
public void testUsingInjectedValues() throws Throwable {
    CQLMetrics cqlMetrics = new CQLMetrics();
    CQLMetricsTable table = new CQLMetricsTable(KS_NAME, cqlMetrics);
    VirtualKeyspaceRegistry.instance.register(new VirtualKeyspace(KS_NAME, ImmutableList.of(table)));
    // With initial injected values
    cqlMetrics.preparedStatementsExecuted.inc(50);
    cqlMetrics.regularStatementsExecuted.inc(100);
    cqlMetrics.preparedStatementsEvicted.inc(25);
    queryAndValidateMetrics(cqlMetrics);
    // Test again with updated values
    cqlMetrics.preparedStatementsExecuted.inc(150);
    cqlMetrics.regularStatementsExecuted.inc(200);
    cqlMetrics.preparedStatementsEvicted.inc(50);
    queryAndValidateMetrics(cqlMetrics);
}
Also used : CQLMetrics(org.apache.cassandra.metrics.CQLMetrics) Test(org.junit.Test)

Aggregations

CQLMetrics (org.apache.cassandra.metrics.CQLMetrics)1 Test (org.junit.Test)1