Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap Redis connection based on type of RedisConnection in RedisAspect #337

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -56,10 +56,10 @@ public void getClusterConnection() {}

/**
* Intercepts calls to {@link RedisConnectionFactory#getConnection()} (and related), wrapping the
* outcome in a {@link TracingRedisConnection}
* outcome in a {@link TracingRedisConnection} or a {@link TracingRedisClusterConnection}
*
* @param pjp the intercepted join point
* @return a new {@link TracingRedisConnection} wrapping the result of the joint point
* @return a new {@link TracingRedisConnection} or {@link TracingRedisClusterConnection} wrapping the result of the joint point
*/
@Around("getConnection() && connectionFactory()")
public Object aroundGetConnection(final ProceedingJoinPoint pjp) throws Throwable {
@@ -70,6 +70,9 @@ public Object aroundGetConnection(final ProceedingJoinPoint pjp) throws Throwabl
.withSpanNameProvider(RedisSpanNameProvider.PREFIX_OPERATION_NAME(prefixOperationName))
.build();

if(connection instanceof RedisClusterConnection) {
return new TracingRedisClusterConnection((RedisClusterConnection) connection, tracingConfiguration);
}
return new TracingRedisConnection(connection, tracingConfiguration);
}