ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver API Reference Modules metrics DefaultMetrics

DefaultMetrics¶

metrics~DefaultMetrics()

A default implementation of ClientMetrics that exposes the driver events as Node.js events.

An instance of DefaultMetrics is configured by default in the client, you can access this instance using Client#metrics property.

Constructor¶

new DefaultMetrics()

Creates a new instance of DefaultMetrics.

Implements:
  • module:metrics~ClientMetrics

Source

metrics/default-metrics.js, line 21

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

metrics/default-metrics.js, line 41

ignoredErrors :EventEmitter

Emits events when an error is ignored by the retry policy.

Type:
  • EventEmitter

Source

metrics/default-metrics.js, line 81

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

metrics/default-metrics.js, line 88

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

metrics/default-metrics.js, line 64

speculativeExecutions :EventEmitter

Emits events when a speculative execution is started.

Type:
  • EventEmitter

Source

metrics/default-metrics.js, line 75

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:
  • module:metrics~ClientMetrics#onAuthenticationError

Source

metrics/default-metrics.js, line 93

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:
  • module:metrics~ClientMetrics#onClientTimeoutError

Source

metrics/default-metrics.js, line 123

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:
  • module:metrics~ClientMetrics#onClientTimeoutRetry

Source

metrics/default-metrics.js, line 135

onConnectionError(e)

Method invoked when there is a connection error.

Parameters:
Name Type Description
e Error

The error encountered.

Implements:
  • module:metrics~ClientMetrics#onConnectionError

Source

metrics/default-metrics.js, line 99

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:
  • module:metrics~ClientMetrics#onIgnoreError

Source

metrics/default-metrics.js, line 165

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:
  • module:metrics~ClientMetrics#onOtherError

Source

metrics/default-metrics.js, line 129

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:
  • module:metrics~ClientMetrics#onOtherErrorRetry

Source

metrics/default-metrics.js, line 141

onReadTimeoutError(e)

Method invoked when a read timeout error is obtained from the server.

Parameters:
Name Type Description
e ResponseError

The error encountered.

Implements:
  • module:metrics~ClientMetrics#onReadTimeoutError

Source

metrics/default-metrics.js, line 105

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:
  • module:metrics~ClientMetrics#onReadTimeoutRetry

Source

metrics/default-metrics.js, line 147

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 [seconds, nanoseconds] tuple Array, where nanoseconds is the remaining part of the real time that can't be represented in second precision.

Implements:
  • module:metrics~ClientMetrics#onResponse

Source

metrics/default-metrics.js, line 180

onSpeculativeExecution()

Method invoked when a speculative execution is started.

Implements:
  • module:metrics~ClientMetrics#onSpeculativeExecution

Source

metrics/default-metrics.js, line 170

onSuccessfulResponse(latency)

Method invoked when a response is obtained successfully.

Parameters:
Name Type Description
latency Array:.<Number:>

The latency represented in a [seconds, nanoseconds] tuple Array, where nanoseconds is the remaining part of the real time that can't be represented in second precision.

Implements:
  • module:metrics~ClientMetrics#onSuccessfulResponse

Source

metrics/default-metrics.js, line 175

onUnavailableError(e)

Method invoked when an unavailable error is obtained from the server.

Parameters:
Name Type Description
e ResponseError

The error encountered.

Implements:
  • module:metrics~ClientMetrics#onUnavailableError

Source

metrics/default-metrics.js, line 117

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:
  • module:metrics~ClientMetrics#onUnavailableRetry

Source

metrics/default-metrics.js, line 153

onWriteTimeoutError(e)

Method invoked when a write timeout error is obtained from the server.

Parameters:
Name Type Description
e ResponseError

The error encountered.

Implements:
  • module:metrics~ClientMetrics#onWriteTimeoutError

Source

metrics/default-metrics.js, line 111

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:
  • module:metrics~ClientMetrics#onWriteTimeoutRetry

Source

metrics/default-metrics.js, line 159

Was this page helpful?

PREVIOUS
metrics
NEXT
ClientMetrics
  • Create an issue
  • Edit this page

On this page

  • DefaultMetrics
    • Constructor
    • Members
    • Methods
ScyllaDB Node.js Driver
Search Ask AI
  • main
    • main
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • concurrent
      • datastax
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metadata
        • Aggregate
        • ClientState
        • ColumnMetadata
        • Index
        • KeyspaceMetadata
        • MaterializedView
        • Metadata
        • SchemaFunction
        • Strategy
        • TableMetadata
        • UdtField
        • UserDefinedType
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • speculativeExecution
          • ConstantSpeculativeExecutionPolicy
          • NoSpeculativeExecutionPolicy
          • SpeculativeExecutionPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • Long
        • ResultSet
        • ResultStream
        • Row
        • TimeUuid
        • Vector
    • Classes
      • AddressResolver
      • ByteOrderedToken
      • Client
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • HashSet
      • Host
      • HostMap
      • LineString
      • Murmur3Token
      • Point
      • Polygon
      • PreparedInfo
      • RandomToken
      • SslOptions
      • Token
      • TokenRange
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 14 May 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.2