Constructor
new DefaultMetrics()
Creates a new instance of DefaultMetrics.
- Implements:
- Source:
Example
Listening to events emitted
defaultMetrics.errors.on('increment', err => totalErrors++);
defaultMetrics.errors.clientTimeout.on('increment', () => clientTimeoutErrors++);
defaultMetrics.speculativeRetries.on('increment', () => specExecsCount++);
defaultMetrics.responses.on('increment', latency => myHistogram.record(latency));
Members
errors :EventEmitter
Emits all the error events.
Use each of the properties to measure events of specific errors.
Type:
- EventEmitter
Properties:
Name | Type | Description |
---|---|---|
authentication |
EventEmitter | Emits the authentication timeout error events. |
clientTimeout |
EventEmitter | Emits the client timeout error events. |
connection |
EventEmitter | Emits the connection error events. |
readTimeout |
EventEmitter | Emits the read timeout error events obtained from the server. |
other |
EventEmitter | Emits the error events, that are not part of the other categories. |
unavailable |
EventEmitter | Emits the unavailable error events obtained from the server. |
writeTimeout |
EventEmitter | Emits the write timeout error events obtained from the server |
- Source:
ignoredErrors :EventEmitter
Emits events when an error is ignored by the retry policy.
Type:
- EventEmitter
- Source:
responses :EventEmitter
Emits events when a response message is obtained.
Type:
- EventEmitter
Properties:
Name | Type | Description |
---|---|---|
success |
EventEmitter | Emits when a response was obtained as the result of a successful execution. |
- Source:
retries :EventEmitter
Emits all the retry events.
Use each of the properties to measure events of specific retries.
Type:
- EventEmitter
Properties:
Name | Type | Description |
---|---|---|
clientTimeout |
EventEmitter | Emits when an execution is retried as a result of an client timeout. |
other |
EventEmitter | Emits the error events, that are not part of the other categories. |
readTimeout |
EventEmitter | Emits an execution is retried as a result of an read timeout error from the server (coordinator to replica). |
unavailable |
EventEmitter | Emits an execution is retried as a result of an unavailable error from the server. |
writeTimeout |
EventEmitter | Emits an execution is retried as a result of a write timeout error from the server (coordinator to replica). |
- Source:
speculativeExecutions :EventEmitter
Emits events when a speculative execution is started.
Type:
- EventEmitter
- Source:
Methods
onAuthenticationError(e)
Method invoked when an authentication error is obtained from the server.
Parameters:
Name | Type | Description |
---|---|---|
e |
AuthenticationError | Error | The error encountered. |
- Implements:
- Source:
onClientTimeoutError(e)
Method invoked when an error (different than a server or client timeout, authentication or connection error) is encountered when executing a request.
Parameters:
Name | Type | Description |
---|---|---|
e |
OperationTimedOutError | The timeout error. |
- Implements:
- Source:
onClientTimeoutRetry(e)
Method invoked when an execution is retried as a result of a client-level timeout.
Parameters:
Name | Type | Description |
---|---|---|
e |
Error | The error that caused the retry. |
- Implements:
- Source:
onConnectionError(e)
Method invoked when there is a connection error.
Parameters:
Name | Type | Description |
---|---|---|
e |
Error | The error encountered. |
- Implements:
- Source:
onIgnoreError(e)
Method invoked when an error is marked as ignored by the retry policy.
Parameters:
Name | Type | Description |
---|---|---|
e |
Error | The error that was ignored by the retry policy. |
- Implements:
- Source:
onOtherError(e)
Method invoked when an error (different than a server or client timeout, authentication or connection error) is encountered when executing a request.
Parameters:
Name | Type | Description |
---|---|---|
e |
Error | The error encountered. |
- Implements:
- Source:
onOtherErrorRetry(e)
Method invoked when an error (other than a server or client timeout) is retried.
Parameters:
Name | Type | Description |
---|---|---|
e |
Error | The error that caused the retry. |
- Implements:
- Source:
onReadTimeoutError(e)
Method invoked when a read timeout error is obtained from the server.
Parameters:
Name | Type | Description |
---|---|---|
e |
ResponseError | The error encountered. |
- Implements:
- Source:
onReadTimeoutRetry(e)
Method invoked when an execution is retried as a result of a read timeout from the server (coordinator to replica).
Parameters:
Name | Type | Description |
---|---|---|
e |
Error | The error that caused the retry. |
- Implements:
- Source:
onResponse(latency)
Method invoked when any response is obtained, the response can be the result of a successful execution or a server-side error.
Parameters:
Name | Type | Description |
---|---|---|
latency |
Array.<Number> | The latency represented in a |
- Implements:
- Source:
onSpeculativeExecution()
Method invoked when a speculative execution is started.
- Implements:
- Source:
onSuccessfulResponse(latency)
Method invoked when a response is obtained successfully.
Parameters:
Name | Type | Description |
---|---|---|
latency |
Array.<Number> | The latency represented in a |
- Implements:
- Source:
onUnavailableError(e)
Method invoked when an unavailable error is obtained from the server.
Parameters:
Name | Type | Description |
---|---|---|
e |
ResponseError | The error encountered. |
- Implements:
- Source:
onUnavailableRetry(e)
Method invoked when an execution is retried as a result of an unavailable error from the server.
Parameters:
Name | Type | Description |
---|---|---|
e |
Error | The error that caused the retry. |
- Implements:
- Source:
onWriteTimeoutError(e)
Method invoked when a write timeout error is obtained from the server.
Parameters:
Name | Type | Description |
---|---|---|
e |
ResponseError | The error encountered. |
- Implements:
- Source:
onWriteTimeoutRetry(e)
Method invoked when an execution is retried as a result of a write timeout from the server (coordinator to replica).
Parameters:
Name | Type | Description |
---|---|---|
e |
Error | The error that caused the retry. |
- Implements:
- Source: