-
Notifications
You must be signed in to change notification settings - Fork 975
Tracing
Tracing gives insights about individual Redis commands sent to Redis to trace their frequency, duration and to trace of which commands a particular activity consists. Lettuce provides a tracing SPI to avoid mandatory tracing library dependencies. Lettuce ships integrations with Micrometer Tracing and Brave which can be configured through client resources.
With Micrometer tracing enabled, Lettuce creates an observation for each Redis command resulting in spans per Command and corresponding Meters if configured in Micrometer’s ObservationContext
.
Lettuce requires the Micrometer Tracing dependency to provide Tracing functionality. Make sure to include that dependency on your classpath.
If using Maven, add the following dependency to your pom.xml:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing</artifactId>
</dependency>
The following example shows how to configure tracing through ClientResources
:
ObservationRegistry observationRegistry = …;
MicrometerTracing tracing = new MicrometerTracing(observationRegistry, "Redis");
ClientResources resources = ClientResources.builder().tracing(tracing).build();
With Brave tracing enabled, Lettuce creates a span for each Redis command. The following options can be configured:
-
serviceName
(defaults toredis
). -
Endpoint
customizer. This option can be used together with a customSocketAddressResolver
to attach custom endpoint details. -
Span
customizer. Allows for customization of spans based on the actual RedisCommand
object. -
Inclusion/Exclusion of all command arguments in a span. By default, all arguments are included.
Lettuce requires the Brave dependency (at least 5.1) to provide Tracing functionality. Make sure to include that dependency on your classpath.
If using Maven, add the following dependency to your pom.xml:
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave</artifactId>
</dependency>
The following example shows how to configure tracing through ClientResources
:
brave.Tracing clientTracing = …;
BraveTracing tracing = BraveTracing.builder().tracing(clientTracing)
.excludeCommandArgsFromSpanTags()
.serviceName("custom-service-name-goes-here")
.spanCustomizer((command, span) -> span.tag("cmd", command.getType().name()))
.build();
ClientResources resources = ClientResources.builder().tracing(tracing).build();
Lettuce ships with a Tracing SPI in io.lettuce.core.tracing
that allows custom tracer implementations.
Lettuce documentation was moved to https://redis.github.io/lettuce/overview/
Intro
Getting started
- Getting started
- Redis URI and connection details
- Basic usage
- Asynchronous API
- Reactive API
- Publish/Subscribe
- Transactions/Multi
- Scripting and Functions
- Redis Command Interfaces
- FAQ
HA and Sharding
Advanced usage
- Configuring Client resources
- Client Options
- Dynamic Command Interfaces
- SSL Connections
- Native Transports
- Unix Domain Sockets
- Streaming API
- Events
- Command Latency Metrics
- Tracing
- Stateful Connections
- Pipelining/Flushing
- Connection Pooling
- Graal Native Image
- Custom commands
Integration and Extension
Internals