View Source Telemetry Events

Connection Events

[:xandra, :connected]

Executed when a connection connects to its Cassandra node.

Measurements: none

Metadata:

  • :connection (pid/0) - the PID of the connection process
  • :connection_name (term/0 or nil) - given name of the connection or nil if not set
  • :address (String.t/0) - the address of the node the connection is connected to
  • :port (:inet.port_number/0) - the port of the node the connection is connected to
  • :protocol_module (module/0) - the protocol module used for the connection
  • :supported_options (map/0) - Cassandra supported options (mostly useful for internal debugging)

[:xandra, :disconnected]

Executed when a connection disconnects from its Cassandra node.

Measurements: none

Metadata:

  • :connection (pid/0) - the PID of the connection process
  • :connection_name (term/0 or nil) - given name of the connection or nil if not set
  • :address (String.t/0) - the address of the node the connection is connected to
  • :port (:inet.port_number/0) - the port of the node the connection is connected to
  • :reason (usually a Exception.t/0) - the reason for the disconnection

[:xandra, :failed_to_connect]

Available since v0.18.0.

Executed when a connection fails to connect to its Cassandra node.

Measurements: none

Metadata:

  • :connection (pid/0) - the PID of the connection process
  • :connection_name (term/0 or nil) - given name of the connection or nil if not set
  • :address (String.t/0) - the address of the node the connection is connected to
  • :port (:inet.port_number/0) - the port of the node the connection is connected to
  • :reason (usually a Exception.t/0) - the reason for the disconnection

Query Events

The [:xandra, :prepare_query, ...] and [:xandra, :execute_query, ...] events are Telemetry spans. See telemetry:span/3. All the time measurements are in native time unit, so you need to use System.convert_time_unit/3 to convert to the desired time unit.

[:xandra, :prepare_query, ...]

Executed before and after a query is prepared (as a Telemetry span).

Measurements:

  • :system_time (integer/0) - in :native time units (only for [..., :start] events)
  • :monotonic_time (integer/0) - in :native time units
  • :duration (integer/0) - in :native time units (only for [..., :stop] and [..., :exception] events)

Metadata:

  • :connection (pid/0) - the PID of the connection process
  • :connection_name (term/0 or nil) - given name of the connection or nil if not set
  • :address (String.t/0) - the address of the node the connection is connected to
  • :port (:inet.port_number/0) - the port of the node the connection is connected to
  • :query (Xandra.Prepared.t/0) - the query being prepared
  • :extra_metadata (any term) - extra metadata provided by the :telemetry_metadata option
  • :reprepared (boolean/0) - whether the query was reprepared or not (only available for [..., :stop] events)
  • :reason (any term) - if there the result of the query was an error, this is the reason (only available for [..., :stop] events), otherwise it's the error that was raised (only available for [..., :exception] events)
  • :kind (Exception.kind/0) - exception kind (only available for [..., :exception] events)
  • :stacktrace (Exception.stacktrace/0) - exception stacktrace (only available for [..., :exception] events)

[:xandra, :execute_query, ...]

Executed before and after a query is executed (as a Telemetry span).

Measurements:

  • :system_time (integer/0) - in :native time units (only for [..., :start] events)
  • :monotonic_time (integer/0) - in :native time units
  • :duration (integer/0) - in :native time units (only for [..., :stop] and [..., :exception] events)

Metadata:

  • :connection (pid/0) - the PID of the connection process
  • :connection_name (term/0 or nil) - given name of the connection or nil if not set
  • :address (String.t/0) - the address of the node the connection is connected to
  • :port (:inet.port_number/0) - the port of the node the connection is connected to
  • :query (Xandra.Simple.t/0, Xandra.Batch.t/0, or Xandra.Prepared.t/0) - the query being executed
  • :extra_metadata (any term) - extra metadata provided by the :telemetry_metadata option
  • :reason (any term) - if there the result of the query was an error, this is the reason (only available for [..., :stop] events), otherwise it's the error that was raised (only available for [..., :exception] events)
  • :kind (Exception.kind/0) - exception kind (only available for [..., :exception] events)
  • :stacktrace (Exception.stacktrace/0) - exception stacktrace (only available for [..., :exception] events)

[:xandra, :prepared_cache, :hit | :miss]

Executed when a query is executed and the prepared cache is checked.

Measurements: none

Metadata:

  • :connection (pid/0) - the PID of the connection process
  • :connection_name (term/0 or nil) - given name of the connection or nil if not set
  • :address (String.t/0) - the address of the node the connection is connected to
  • :port (:inet.port_number/0) - the port of the node the connection is connected to
  • :query (Xandra.Prepared.t/0) - the query being prepared
  • :extra_metadata (any term) - extra metadata provided by the :telemetry_metadata option

Warnings

[:xandra, :server_warnings]

Executed when a query returns warnings.

Measurements:

  • :warnings (non-empty list of String.t/0) - a list of warnings

Metadata:

Cluster Events

Unless specified otherwise, these are available since v0.15.0.

[:xandra, :cluster, :change_event]

Emitted when there is a change in the cluster, either as reported by Cassandra itself or as detected by Xandra.

Measurements: none

Metadata:

  • :cluster_pid (pid/0) - the PID of the cluster process
  • :cluster_name (String.t/0 or nil) - the name of the cluster executing the event, if provided through the :name option in Xandra.Cluster.start_link/1
  • :host (Xandra.Cluster.Host.t/0) - the host the event is related to
  • :event_type (atom/0) - one of :host_up (a host went up), :host_down (a host went down), :host_added (a host was added to the cluster topology), or :host_removed (a host was removed from the cluster topology)

[:xandra, :cluster, :discovered_peers]

Available since v0.17.0.

Executed when the Xandra cluster's control connection discovers peers. The peers might have been already discovered in the past, so you'll need to keep track of new peers if you need to.

Measurements:

Metadata:

[:xandra, :cluster, :pool, :started | :restarted | :stopped]

Available since v0.17.0.

Executed when a connection pool to a node is started, restarted, or stopped.

Measurements: none

Metadata:

[:xandra, :cluster, :control_connection, :connected]

Emitted when the control connection for the cluster is established.

Measurements: none

Metadata:

[:xandra, :cluster, :control_connection, :disconnected | :failed_to_connect]

Emitted when the control connection for the cluster disconnects or fails to connect.

Measurements: none

Metadata:

  • :cluster_pid (pid/0) - the PID of the cluster process
  • :cluster_name (String.t/0 or nil) - the name of the cluster executing the event, if provided through the :name option in Xandra.Cluster.start_link/1
  • :host (Xandra.Cluster.Host.t/0) - the host the event is related to
  • :reason (any term) - the reason for the disconnection or failure to connect