
io.lettuce.core.protocol.TracedCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lettuce-core Show documentation
Show all versions of lettuce-core Show documentation
Advanced and thread-safe Java Redis client for synchronous, asynchronous, and
reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs
and much more.
The newest version!
package io.lettuce.core.protocol;
import io.lettuce.core.tracing.TraceContext;
import io.lettuce.core.tracing.TraceContextProvider;
import io.lettuce.core.tracing.Tracer;
import io.netty.buffer.ByteBuf;
/**
* Redis command that is aware of an associated {@link TraceContext}.
*
* @author Mark Paluch
* @since 5.1
*/
public class TracedCommand extends CommandWrapper implements TraceContextProvider {
private final TraceContext traceContext;
private Tracer.Span span;
public TracedCommand(RedisCommand command, TraceContext traceContext) {
super(command);
this.traceContext = traceContext;
}
@Override
public TraceContext getTraceContext() {
return traceContext;
}
public Tracer.Span getSpan() {
return span;
}
public void setSpan(Tracer.Span span) {
this.span = span;
}
@Override
public void encode(ByteBuf buf) {
if (span != null) {
span.annotate("redis.encode.start");
}
super.encode(buf);
if (span != null) {
span.annotate("redis.encode.end");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy