This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Data Cassandra 4.4.0!spring-doc.cn

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.spring-doc.cn

To enable the instrumentation, apply the following configuration to your application:spring-doc.cn

@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.spring-doc.cn

Conventions

Below you can find a list of all GlobalObservabilityConventions and ObservabilityConventions declared by this project.spring-doc.cn

Table 1. ObservationConvention implementations

ObservationConvention Class Namespring-doc.cn

Applicable ObservationContext Class Namespring-doc.cn

org.springframework.data.cassandra.observability.DefaultCassandraObservationConventionspring-doc.cn

n/aspring-doc.cn

Metrics

Below you can find a list of all metrics declared by this project.spring-doc.cn

Cassandra Query Observation

Create an io.micrometer.observation.Observation for Cassandra-based queries.spring-doc.cn

Metric name spring.data.cassandra.query. Type timer and base unit seconds.spring-doc.cn

Fully qualified name of the enclosing class org.springframework.data.cassandra.observability.CassandraObservation.spring-doc.cn

Table 2. Low cardinality Keys

Descriptionspring-doc.cn

db.cassandra.coordinator.dcspring-doc.cn

db.cassandra.coordinator.idspring-doc.cn

db.namespring-doc.cn

Name of the Cassandra keyspace.spring-doc.cn

db.operationspring-doc.cn

The database operation.spring-doc.cn

db.systemspring-doc.cn

Database system.spring-doc.cn

net.peer.namespring-doc.cn

Name of the database host.spring-doc.cn

net.peer.portspring-doc.cn

Logical remote port number.spring-doc.cn

net.sock.peer.addrspring-doc.cn

Cassandra peer address.spring-doc.cn

net.sock.peer.portspring-doc.cn

Cassandra peer port.spring-doc.cn

net.transportspring-doc.cn

Network transport.spring-doc.cn

spring.data.cassandra.methodNamespring-doc.cn

The method namespring-doc.cn

spring.data.cassandra.sessionNamespring-doc.cn

Cassandra sessionspring-doc.cn

Table 3. High cardinality Keys

Descriptionspring-doc.cn

db.cassandra.consistency_levelspring-doc.cn

db.cassandra.idempotencespring-doc.cn

db.cassandra.page_sizespring-doc.cn

db.statementspring-doc.cn

A key-value containing Cassandra CQL.spring-doc.cn

spring.data.cassandra.node[%s].errorspring-doc.cn

A tag containing error that occurred for the given node. (since the name contains %s the final value will be resolved at runtime)spring-doc.cn

Spans

Below you can find a list of all spans declared by this project.spring-doc.cn

Cassandra Query Observation Span

Create an io.micrometer.observation.Observation for Cassandra-based queries.spring-doc.cn

Span name spring.data.cassandra.query.spring-doc.cn

Fully qualified name of the enclosing class org.springframework.data.cassandra.observability.CassandraObservation.spring-doc.cn

Table 4. Tag Keys

Namespring-doc.cn

Descriptionspring-doc.cn

db.cassandra.consistency_levelspring-doc.cn

db.cassandra.coordinator.dcspring-doc.cn

db.cassandra.coordinator.idspring-doc.cn

db.cassandra.idempotencespring-doc.cn

db.cassandra.page_sizespring-doc.cn

db.namespring-doc.cn

Name of the Cassandra keyspace.spring-doc.cn

db.operationspring-doc.cn

The database operation.spring-doc.cn

db.statementspring-doc.cn

A key-value containing Cassandra CQL.spring-doc.cn

db.systemspring-doc.cn

Database system.spring-doc.cn

net.peer.namespring-doc.cn

Name of the database host.spring-doc.cn

net.peer.portspring-doc.cn

Logical remote port number.spring-doc.cn

net.sock.peer.addrspring-doc.cn

Cassandra peer address.spring-doc.cn

net.sock.peer.portspring-doc.cn

Cassandra peer port.spring-doc.cn

net.transportspring-doc.cn

Network transport.spring-doc.cn

spring.data.cassandra.methodNamespring-doc.cn

The method namespring-doc.cn

spring.data.cassandra.node[%s].errorspring-doc.cn

A tag containing error that occurred for the given node. (since the name contains %s the final value will be resolved at runtime)spring-doc.cn

spring.data.cassandra.sessionNamespring-doc.cn

Cassandra sessionspring-doc.cn