Since 2.1.2
The Cassandra Driver instrumentation automatically traces queries sent to Cassandra, and collects performance metrics for the driver sessions and connection pools.
With the default configuration, the driver instrumentation will only trace calls to Session.execute(...)
. For example,
if you prepare a statement and execute seven different queries on a session, your trace will look similar to this:
Each executed query generates a single Span, regardless of whether the query had to be retried or speculated on.
All query spans will contain these tags:
cassandra.driver
.cassandra
.Additionally, for select queries there are three additional tags with information about the ResultSet
returned for the
query:
In addition to the query tracing, the instrumentation can produce Spans for every round trip between the Cassandra
driver and the server. Round trip tracing is disabled by default because it significantly increases the number of Spans
generated for every executed query. You can enable it by changing this setting in your application.conf
file:
kamon.instrumentation.cassandra {
tracing.create-round-trip-spans = no
}
Every interaction with Cassandra servers is traced when round trip tracing is enabled, including preparation of statements, retries and speculative executions. For example, the same application used in the query tracing above generates all these Spans in a normal request processing:
Notice the cassandra.query.prepare
span, and all of the cassandra.query.execution
spans that were automatically
created for each query sent to Cassandra.
All the round trip Spans are tagged with:
Use with caution. The number of Spans generated when round trip tracing is enabled can overwhelm your tracing system.
If you want to completely disable tracing of Cassandra queries and round trips, set the
kamon.instrumentation.cassandra.tracing.enabled
setting to no
, as shown below:
kamon.instrumentation.cassandra {
tracing.enabled = no
}
All the following metrics are automatically tracked for all Cassandra Driver sessions:
The instrumentation can automatically collect metrics for all connection pools created by the Cassandra Driver. This feature is disabled by default, because the Casssandra Driver creates one connection pool for each node it connects to, which could mean tracking tens to hundreds of connection pools.
If you wish to enable connection pool metrics, set the kamon.instrumentation.cassandra.metrics.track-node-connection-pools
setting to yes
, as shown below:
kamon.instrumentation.cassandra {
metrics.track-node-connection-pools = yes
}
When connection pool tracking is enabled, you will start seeing these metrics for all connection pools:
In case you are not using the Kamon Bundle, add the dependency below to your build.
libraryDependencies += "io.kamon" %% "kamon-cassandra" % "2.5.9"
<dependency>
<groupId>io.kamon</groupId>
<artifactId>kamon-cassandra_2.13</artifactId>
<version>2.5.9</version>
</dependency>
implementation 'io.kamon:kamon-cassandra_2.13:2.5.9'
You must start your application with the instrumentation agent for this module to work properly.