Search in sources :

Example 1 with StreamingMetrics

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

the class StreamingMetricsTest method checkDataReceived.

private void checkDataReceived(Cluster cluster, int node, int peer, long receivedBytes, int files) {
    InetAddressAndPort address = getNodeAddress(cluster, peer);
    cluster.get(node).runOnInstance(() -> {
        StreamingMetrics metrics = StreamingMetrics.get(address);
        long actual = metrics.incomingBytes.getCount();
        assertThat(actual).describedAs("The amount of data received by node" + node + " from node" + peer + " is not the expected one. [expected: " + receivedBytes + ", actual: " + actual + "]").isEqualTo(receivedBytes);
        actual = metrics.incomingProcessTime.getCount();
        // The incomingProcessTime timer is updated for each incoming file. By consequence incomingProcessTime.getCount() should be equals to the number of files received by the node.
        assertThat(actual).describedAs("The amount of files received by node" + node + " from node" + peer + " is not the expected one. [expected: " + files + ", actual: " + actual + "]").isEqualTo(files);
        if (metrics.incomingProcessTime.getCount() != 0) {
            assertThat(metrics.incomingProcessTime.getSnapshot().getMedian()).describedAs("The median processing time for data streamed from node" + peer + " to node" + node + " should be non-0").isGreaterThan(0);
        }
    });
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) StreamingMetrics(org.apache.cassandra.metrics.StreamingMetrics)

Example 2 with StreamingMetrics

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

the class StreamingMetricsTest method checkThatNoStreamingOccured.

private void checkThatNoStreamingOccured(Cluster cluster, int node, int peer) {
    InetAddressAndPort address = getNodeAddress(cluster, peer);
    cluster.get(node).runOnInstance(() -> {
        StreamingMetrics metrics = StreamingMetrics.get(address);
        assertThat(metrics.incomingBytes.getCount()).describedAs("No SSTable should have been streamed so far from node" + node + " to node" + peer).isEqualTo(0);
        assertThat(metrics.outgoingBytes.getCount()).describedAs("No SSTable should have been streamed so far from node" + node + " to node" + peer).isEqualTo(0);
        assertThat(metrics.incomingProcessTime.getCount()).describedAs("No SSTable should have been streamed so far from node" + node + " to node" + peer).isEqualTo(0);
    });
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) StreamingMetrics(org.apache.cassandra.metrics.StreamingMetrics)

Example 3 with StreamingMetrics

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

the class StreamingMetricsTest method checkDataSent.

private long checkDataSent(Cluster cluster, int node, int peer) {
    InetAddressAndPort address = getNodeAddress(cluster, peer);
    return cluster.get(node).callOnInstance(() -> {
        StreamingMetrics metrics = StreamingMetrics.get(address);
        long outgoingBytes = metrics.outgoingBytes.getCount();
        assertThat(outgoingBytes).describedAs("There should be data streamed from node" + node + " to node" + peer).isGreaterThan(0);
        return outgoingBytes;
    });
}
Also used : InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) StreamingMetrics(org.apache.cassandra.metrics.StreamingMetrics)

Aggregations

InetAddressAndPort (org.apache.cassandra.locator.InetAddressAndPort)3 StreamingMetrics (org.apache.cassandra.metrics.StreamingMetrics)3