Add OpenTelemetry tracing support for Redis commands

- Add RedisSpan interface in rbcs-api for opaque span handles
- Extend TelemetryController with startRedisSpan/endRedisSpan methods
- Implement Redis tracing in rbcs-server-otel via OtelController and RedisOtelSpan
- Instrument RedisCacheHandler to create spans around GET and SET commands
- Add uses directive in rbcs-server-redis module-info for ServiceLoader discovery

Redis spans are created as CLIENT spans with attributes:
db.system=redis, db.operation=GET|SET, server.address, server.port
This commit is contained in:
opencode
2026-05-21 00:48:37 +00:00
committed by Walter Oggioni
parent 316f9e61b0
commit f154bbd33c
6 changed files with 136 additions and 41 deletions
@@ -0,0 +1,10 @@
package net.woggioni.rbcs.api;
import org.jetbrains.annotations.NotNull;
public interface RedisSpan {
void setAttribute(@NotNull String key, @NotNull String value);
void setAttribute(@NotNull String key, long value);
}
@@ -2,8 +2,15 @@ package net.woggioni.rbcs.api;
import io.netty.channel.ChannelHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface TelemetryController {
void initialize();
@NotNull ChannelHandler createHandler();
@Nullable RedisSpan startRedisSpan(@NotNull String command, @NotNull String key);
void endRedisSpan(@Nullable RedisSpan span);
void endRedisSpan(@Nullable RedisSpan span, @NotNull Throwable error);
}