从应用程序组件中获取有关其操作、时序以及与应用程序代码的关系的见解对于了解延迟至关重要。 Spring Data Redis 通过 Lettuce 驱动程序附带了 Micrometer 集成,以在 Redis 交互期间收集观测值。 设置集成后,Micrometer 将为每个 Redis 命令创建米和跨度(用于分布式跟踪)。Spring中文文档

要启用集成,请将以下配置应用于:LettuceClientConfigurationSpring中文文档

@Configuration
class ObservabilityConfiguration {

  @Bean
  public ClientResources clientResources(ObservationRegistry observationRegistry) {

    return ClientResources.builder()
              .tracing(new MicrometerTracingAdapter(observationRegistry, "my-redis-cache"))
              .build();
  }

  @Bean
  public LettuceConnectionFactory lettuceConnectionFactory(ClientResources clientResources) {

    LettuceClientConfiguration clientConfig = LettuceClientConfiguration.builder()
                                                .clientResources(clientResources).build();
    RedisConfiguration redisConfiguration = …;
    return new LettuceConnectionFactory(redisConfiguration, clientConfig);
  }
}

可观测性 - 指标

您可以在下面找到此项目声明的所有指标的列表。Spring中文文档

Redis 命令观察

围绕 Redis 命令执行创建的计时器。Spring中文文档

指标名称类型基本单位spring.data.redistimersecondsSpring中文文档

封闭类 .org.springframework.data.redis.connection.lettuce.observability.RedisObservationSpring中文文档

表 1.低基数键

db.operationSpring中文文档

Redis 命令值。Spring中文文档

db.redis.database_indexSpring中文文档

Redis 数据库索引。Spring中文文档

数据库系统。Spring中文文档

Redis 用户。Spring中文文档

net.peer.nameSpring中文文档

数据库主机的名称。Spring中文文档

net.peer.portSpring中文文档

逻辑远程端口号。Spring中文文档

net.sock.peer.addrSpring中文文档

Mongo 对等地址。Spring中文文档

net.sock.peer.portSpring中文文档

Mongo 对等端口。Spring中文文档

net.transportSpring中文文档

网络传输。Spring中文文档

表 2.高基数键

db.statementSpring中文文档

Redis 语句。Spring中文文档

spring.data.redis.command.errorSpring中文文档

Redis 错误响应。Spring中文文档

表 1.低基数键

db.operationSpring中文文档

Redis 命令值。Spring中文文档

db.redis.database_indexSpring中文文档

Redis 数据库索引。Spring中文文档

数据库系统。Spring中文文档

Redis 用户。Spring中文文档

net.peer.nameSpring中文文档

数据库主机的名称。Spring中文文档

net.peer.portSpring中文文档

逻辑远程端口号。Spring中文文档

net.sock.peer.addrSpring中文文档

Mongo 对等地址。Spring中文文档

net.sock.peer.portSpring中文文档

Mongo 对等端口。Spring中文文档

net.transportSpring中文文档

网络传输。Spring中文文档

表 2.高基数键

db.statementSpring中文文档

Redis 语句。Spring中文文档

spring.data.redis.command.errorSpring中文文档

Redis 错误响应。Spring中文文档

可观测性 - 跨度

您可以在下面找到此项目声明的所有跨度的列表。Spring中文文档

Redis 命令观察跨度

围绕 Redis 命令执行创建的计时器。Spring中文文档

跨度名称spring.data.redisSpring中文文档

封闭类 .org.springframework.data.redis.connection.lettuce.observability.RedisObservationSpring中文文档

表 3.标签键

名字Spring中文文档

描述Spring中文文档

db.operationSpring中文文档

Redis 命令值。Spring中文文档

db.redis.database_indexSpring中文文档

Redis 数据库索引。Spring中文文档

db.statementSpring中文文档

Redis 语句。Spring中文文档

db.systemSpring中文文档

数据库系统。Spring中文文档

db.userSpring中文文档

Redis 用户。Spring中文文档

net.peer.nameSpring中文文档

数据库主机的名称。Spring中文文档

net.peer.portSpring中文文档

逻辑远程端口号。Spring中文文档

net.sock.peer.addrSpring中文文档

Mongo 对等地址。Spring中文文档

net.sock.peer.portSpring中文文档

Mongo 对等端口。Spring中文文档

net.transportSpring中文文档

网络传输。Spring中文文档

spring.data.redis.command.errorSpring中文文档

Redis 错误响应。Spring中文文档

表 3.标签键

名字Spring中文文档

描述Spring中文文档

db.operationSpring中文文档

Redis 命令值。Spring中文文档

db.redis.database_indexSpring中文文档

Redis 数据库索引。Spring中文文档

db.statementSpring中文文档

Redis 语句。Spring中文文档

db.systemSpring中文文档

数据库系统。Spring中文文档

db.userSpring中文文档

Redis 用户。Spring中文文档

net.peer.nameSpring中文文档

数据库主机的名称。Spring中文文档

net.peer.portSpring中文文档

逻辑远程端口号。Spring中文文档

net.sock.peer.addrSpring中文文档

Mongo 对等地址。Spring中文文档

net.sock.peer.portSpring中文文档

Mongo 对等端口。Spring中文文档

net.transportSpring中文文档

网络传输。Spring中文文档

spring.data.redis.command.errorSpring中文文档

Redis 错误响应。Spring中文文档