Search in sources :

Example 1 with ClientRequestMetrics

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

the class QueryProcessor method processNodeLocalSelect.

private ResultMessage processNodeLocalSelect(SelectStatement statement, QueryState queryState, QueryOptions options) {
    ClientRequestMetrics levelMetrics = ClientRequestsMetricsHolder.readMetricsForLevel(ConsistencyLevel.NODE_LOCAL);
    ClientRequestMetrics globalMetrics = ClientRequestsMetricsHolder.readMetrics;
    if (StorageService.instance.isBootstrapMode() && !SchemaConstants.isLocalSystemKeyspace(statement.keyspace())) {
        levelMetrics.unavailables.mark();
        globalMetrics.unavailables.mark();
        throw new IsBootstrappingException();
    }
    long startTime = nanoTime();
    try {
        return statement.executeLocally(queryState, options);
    } finally {
        long latency = nanoTime() - startTime;
        levelMetrics.addNano(latency);
        globalMetrics.addNano(latency);
    }
}
Also used : ClientRequestMetrics(org.apache.cassandra.metrics.ClientRequestMetrics)

Example 2 with ClientRequestMetrics

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

the class QueryProcessor method processNodeLocalWrite.

private ResultMessage processNodeLocalWrite(CQLStatement statement, QueryState queryState, QueryOptions options) {
    ClientRequestMetrics levelMetrics = ClientRequestsMetricsHolder.writeMetricsForLevel(ConsistencyLevel.NODE_LOCAL);
    ClientRequestMetrics globalMetrics = ClientRequestsMetricsHolder.writeMetrics;
    long startTime = nanoTime();
    try {
        return statement.executeLocally(queryState, options);
    } finally {
        long latency = nanoTime() - startTime;
        levelMetrics.addNano(latency);
        globalMetrics.addNano(latency);
    }
}
Also used : ClientRequestMetrics(org.apache.cassandra.metrics.ClientRequestMetrics)

Aggregations

ClientRequestMetrics (org.apache.cassandra.metrics.ClientRequestMetrics)2