Observability
从应用程序组件中获取其操作、时间安排和与应用程序代码相关的信息对于了解延迟至关重要。Spring Data Cassandra 提供了通过 Cassandra 驱动程序进行的 Micrometer 工具,以在 Cassandra 交互期间收集观察。一旦设置好集成,Micrometer 就会为每个 Cassandra 语句创建度量和跨度(用于分布式跟踪)。
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. |
另请参见 OpenTelemetry Semantic Conventions以供参考。
See also OpenTelemetry Semantic Conventions for further reference.
Conventions
下面你可以找到此项目声明的所有 GlobalObservabilityConventions
和 ObservabilityConventions
的列表。
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
针对基于 Cassandra 的查询创建 io.micrometer.observation.Observation
。
Create an io.micrometer.observation.Observation
for Cassandra-based queries.
指标名称 spring.data.cassandra.query
。类型 timer
和 基本单位 seconds
。
Metric name spring.data.cassandra.query
. Type timer
and base unit seconds
.
封闭类的限定名称 org.springframework.data.cassandra.observability.CassandraObservation
。
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
下面您可以找到此项目声明的所有 span 的列表。
Below you can find a list of all spans declared by this project.
Cassandra Query Observation Span
针对基于 Cassandra 的查询创建 io.micrometer.observation.Observation
。
Create an io.micrometer.observation.Observation
for Cassandra-based queries.
跨度名称 spring.data.cassandra.query
。
Span name spring.data.cassandra.query
.
封闭类的限定名称 org.springframework.data.cassandra.observability.CassandraObservation
。
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 |