public class MetricsCollectingExecutionListener extends Object implements ExecutionListener
ExecutionListener that records useful metrics about the ongoing bulk operations.| Constructor and Description |
|---|
MetricsCollectingExecutionListener()
Creates a new instance using a newly-allocated
MetricRegistry. |
MetricsCollectingExecutionListener(com.codahale.metrics.MetricRegistry registry,
ProtocolVersion protocolVersion,
CodecRegistry codecRegistry,
boolean trackThroughputInBytes)
Creates a new instance using the given
MetricRegistry. |
| Modifier and Type | Method and Description |
|---|---|
Optional<com.codahale.metrics.Meter> |
getBytesReceivedMeter()
Returns a
Meter that evaluates the total number of bytes received so far. |
Optional<com.codahale.metrics.Meter> |
getBytesSentMeter()
Returns a
Meter that evaluates the total number of bytes sent so far. |
com.codahale.metrics.Counter |
getFailedReadsCounter()
Returns a
Counter that evaluates the duration of execution of failed reads. |
com.codahale.metrics.Counter |
getFailedReadsWritesCounter()
Returns a
Counter that evaluates the duration of execution of all failed operations,
including reads and writes. |
com.codahale.metrics.Counter |
getFailedStatementsCounter()
Returns a
Counter for failed statement executions. |
com.codahale.metrics.Counter |
getFailedWritesCounter()
Returns a
Counter that evaluates the duration of execution of failed writes. |
com.codahale.metrics.Counter |
getInFlightRequestsCounter()
Returns a
Counter that evaluates the number of current in-flight requests, i.e. |
com.codahale.metrics.MetricRegistry |
getRegistry()
Returns the
MetricRegistry used to aggregate metrics for this listener. |
com.codahale.metrics.Counter |
getSuccessfulReadsCounter()
Returns a
Counter that evaluates the duration of execution of successful reads. |
com.codahale.metrics.Counter |
getSuccessfulReadsWritesCounter()
Returns a
Counter that evaluates the duration of execution of all successful
operations, including reads and writes. |
com.codahale.metrics.Counter |
getSuccessfulStatementsCounter()
Returns a
Counter for successful statement executions. |
com.codahale.metrics.Counter |
getSuccessfulWritesCounter()
Returns a
Counter that evaluates the duration of execution of successful writes. |
com.codahale.metrics.Timer |
getTotalReadsTimer()
Returns a
Timer that evaluates the duration of execution of reads, both successful and
failed. |
com.codahale.metrics.Timer |
getTotalReadsWritesTimer()
Returns a
Timer that evaluates the duration of execution of all operations, including
reads and writes, both successful and failed. |
com.codahale.metrics.Timer |
getTotalStatementsTimer()
Returns a
Timer for total statement executions (successful and failed). |
com.codahale.metrics.Timer |
getTotalWritesTimer()
Returns a
Timer that evaluates the duration of execution of writes, both successful and
failed. |
void |
onExecutionFailed(BulkExecutionException exception,
ExecutionContext context)
Called when a statement execution has failed.
|
void |
onExecutionSuccessful(Statement<?> statement,
ExecutionContext context)
Called when a statement has been successfully executed.
|
void |
onReadRequestFailed(Statement<?> statement,
Throwable error,
ExecutionContext context)
Called when a read request has failed.
|
void |
onReadRequestStarted(Statement<?> statement,
ExecutionContext context)
Called when a read request is about to be sent.
|
void |
onReadRequestSuccessful(Statement<?> statement,
ExecutionContext context)
Called when a read request has been completed successfully.
|
void |
onRowReceived(Row row,
ExecutionContext context)
Called when a row has been successfully received.
|
void |
onWriteRequestFailed(Statement<?> statement,
Throwable error,
ExecutionContext context)
Called when a write request has failed.
|
void |
onWriteRequestStarted(Statement<?> statement,
ExecutionContext context)
Called when a write request is about to be sent.
|
void |
onWriteRequestSuccessful(Statement<?> statement,
ExecutionContext context)
Called when a write request has been completed successfully.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonExecutionStartedpublic MetricsCollectingExecutionListener()
MetricRegistry.public MetricsCollectingExecutionListener(com.codahale.metrics.MetricRegistry registry,
ProtocolVersion protocolVersion,
CodecRegistry codecRegistry,
boolean trackThroughputInBytes)
MetricRegistry.registry - The MetricRegistry to use.protocolVersion - the ProtocolVersion to use.codecRegistry - the CodecRegistry to use.trackThroughputInBytes - Whether to track throughput in bytes or not.public com.codahale.metrics.MetricRegistry getRegistry()
MetricRegistry used to aggregate metrics for this listener.MetricRegistry used to aggregate metrics for this listener.public com.codahale.metrics.Timer getTotalStatementsTimer()
Timer for total statement executions (successful and failed).
A batch statement is counted as one single statement. If that's not what you want, you are
probably looking for getTotalWritesTimer().
Timer for total statement executions (successful and failed).public com.codahale.metrics.Counter getSuccessfulStatementsCounter()
Counter for successful statement executions.
A batch statement is counted as one single statement. If that's not what you want, you are
probably looking for getSuccessfulWritesCounter().
Counter for successful statement executions.public com.codahale.metrics.Counter getFailedStatementsCounter()
Counter for failed statement executions.
A batch statement is counted as one single statement. If that's not what you want, you are
probably looking for getFailedWritesCounter().
Counter for failed statement executions.public com.codahale.metrics.Timer getTotalReadsTimer()
Timer that evaluates the duration of execution of reads, both successful and
failed.Timer that evaluates the duration of execution of reads, both successful and
failed.public com.codahale.metrics.Counter getSuccessfulReadsCounter()
Counter that evaluates the duration of execution of successful reads.Counter that evaluates the duration of execution of successful reads.public com.codahale.metrics.Counter getFailedReadsCounter()
Counter that evaluates the duration of execution of failed reads.Counter that evaluates the duration of execution of failed reads.public com.codahale.metrics.Timer getTotalWritesTimer()
Timer that evaluates the duration of execution of writes, both successful and
failed.
A batch statement is counted as many times as the number of child statements it contains. If
that's not what you want, you are probably looking for getTotalStatementsTimer().
Timer that evaluates the duration of execution of writes, both successful and
failed.public com.codahale.metrics.Counter getSuccessfulWritesCounter()
Counter that evaluates the duration of execution of successful writes.
A batch statement is counted as many times as the number of child statements it contains. If
that's not what you want, you are probably looking for getSuccessfulStatementsCounter().
Counter that evaluates the duration of execution of successful writes.public com.codahale.metrics.Counter getFailedWritesCounter()
Counter that evaluates the duration of execution of failed writes.
A batch statement is counted as many times as the number of child statements it contains. If
that's not what you want, you are probably looking for getFailedStatementsCounter().
Counter that evaluates the duration of execution of failed writes.public com.codahale.metrics.Timer getTotalReadsWritesTimer()
Timer that evaluates the duration of execution of all operations, including
reads and writes, both successful and failed.Timer that evaluates the duration of execution of all operations.public com.codahale.metrics.Counter getSuccessfulReadsWritesCounter()
Counter that evaluates the duration of execution of all successful
operations, including reads and writes.Counter that evaluates the duration of execution of all successful
operations.public com.codahale.metrics.Counter getFailedReadsWritesCounter()
Counter that evaluates the duration of execution of all failed operations,
including reads and writes.Counter that evaluates the duration of execution of all failed operations.public com.codahale.metrics.Counter getInFlightRequestsCounter()
Counter that evaluates the number of current in-flight requests, i.e. the
number of uncompleted futures waiting for a response from the server.Counter that evaluates the number of current in-flight requests.public Optional<com.codahale.metrics.Meter> getBytesSentMeter()
Meter that evaluates the total number of bytes sent so far.
Note that this counter's value is an estimate of the actual amount of data sent; it might be inaccurate or even zero, if the data size cannot be calculated.
Meter that evaluates the total number of bytes sent so far.public Optional<com.codahale.metrics.Meter> getBytesReceivedMeter()
Meter that evaluates the total number of bytes received so far.
Note that this counter's value is an estimate of the actual amount of data received; it might be inaccurate or even zero, if the data size cannot be calculated.
Meter that evaluates the total number of bytes received so far.public void onWriteRequestStarted(Statement<?> statement, ExecutionContext context)
ExecutionListeneronWriteRequestStarted in interface ExecutionListenerstatement - the statement to execute.context - the local request execution context.public void onReadRequestStarted(Statement<?> statement, ExecutionContext context)
ExecutionListeneronReadRequestStarted in interface ExecutionListenerstatement - the statement to execute.context - the local request execution context.public void onWriteRequestSuccessful(Statement<?> statement, ExecutionContext context)
ExecutionListeneronWriteRequestSuccessful in interface ExecutionListenerstatement - the statement to execute.context - the local request execution context.public void onWriteRequestFailed(Statement<?> statement, Throwable error, ExecutionContext context)
ExecutionListeneronWriteRequestFailed in interface ExecutionListenerstatement - the statement to execute.error - the request execution error.context - the local request execution context.public void onReadRequestSuccessful(Statement<?> statement, ExecutionContext context)
ExecutionListeneronReadRequestSuccessful in interface ExecutionListenerstatement - the statement to execute.context - the local request execution context.public void onRowReceived(Row row, ExecutionContext context)
ExecutionListenerNote: this method is called when the row is effectively read and emitted to downstream subscribers, which might be later than the moment when it was made available by the driver.
onRowReceived in interface ExecutionListenerrow - the row.context - the local request execution context.public void onReadRequestFailed(Statement<?> statement, Throwable error, ExecutionContext context)
ExecutionListeneronReadRequestFailed in interface ExecutionListenerstatement - the statement to execute.error - the request execution error.context - the local request execution context.public void onExecutionSuccessful(Statement<?> statement, ExecutionContext context)
ExecutionListeneronExecutionSuccessful in interface ExecutionListenerstatement - the executed statement.context - the global statement execution context.public void onExecutionFailed(BulkExecutionException exception, ExecutionContext context)
ExecutionListeneronExecutionFailed in interface ExecutionListenerexception - the error encountered.context - the statement execution context.Copyright © 2017–2021 DataStax. All rights reserved.