For the latest stable version, please use Spring Data Cassandra 4.4.0! |
Observability
Getting insights from an application component about its operations, timing and relation to application code is crucial to understand latency. Spring Data Cassandra ships with a Micrometer instrumentation through the Cassandra driver to collect observations during Cassandra interaction. Once the integration is set up, Micrometer will create meters and spans (for distributed tracing) for each Cassandra statement.
To enable the instrumentation, apply the following configuration to your application:
@Configuration
class ObservabilityConfiguration {
@Bean
public ObservableCqlSessionFactoryBean observableCqlSession(CqlSessionBuilder builder,
ObservationRegistry registry) {
return new ObservableCqlSessionFactoryBean(builder, registry); (1)
}
@Bean
public ObservableReactiveSessionFactoryBean observableReactiveSession(CqlSession session,
ObservationRegistry registry) {
return new ObservableReactiveSessionFactoryBean(session, registry); (2)
}
}
1 | Wraps the CQL session object to observe Cassandra statement execution.
Also, registers ObservationRequestTracker.INSTANCE with the CqlSessionBuilder . |
2 | Wraps a CQL session object to observe reactive Cassandra statement execution. |
See also OpenTelemetry Semantic Conventions for further reference.
Conventions
Below you can find a list of all GlobalObservabilityConventions
and ObservabilityConventions
declared by this project.
ObservationConvention Class Name |
Applicable ObservationContext Class Name |
|
|
Metrics
Below you can find a list of all metrics declared by this project.
Cassandra Query Observation
Create an
io.micrometer.observation.Observation
for Cassandra-based queries.
Metric name spring.data.cassandra.query
. Type timer
and base unit seconds
.
Fully qualified name of the enclosing class org.springframework.data.cassandra.observability.CassandraObservation
.
Name |
Description |
|
|
|
|
|
Name of the Cassandra keyspace. |
|
The database operation. |
|
Database system. |
|
Name of the database host. |
|
Logical remote port number. |
|
Cassandra peer address. |
|
Cassandra peer port. |
|
Network transport. |
|
The method name |
|
Cassandra session |
Name |
Description |
|
|
|
|
|
|
|
A key-value containing Cassandra CQL. |
|
A tag containing error that occurred for the given node. (since the name contains |
Spans
Below you can find a list of all spans declared by this project.
Cassandra Query Observation Span
Create an
io.micrometer.observation.Observation
for Cassandra-based queries.
Span name spring.data.cassandra.query
.
Fully qualified name of the enclosing class org.springframework.data.cassandra.observability.CassandraObservation
.
Name |
Description |
|
|
|
|
|
|
|
|
|
|
|
Name of the Cassandra keyspace. |
|
The database operation. |
|
A key-value containing Cassandra CQL. |
|
Database system. |
|
Name of the database host. |
|
Logical remote port number. |
|
Cassandra peer address. |
|
Cassandra peer port. |
|
Network transport. |
|
The method name |
|
A tag containing error that occurred for the given node. (since the name contains |
|
Cassandra session |