Skip to content

Commit b3f6622

Browse files
committed
post-review fixes
1 parent e1311db commit b3f6622

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

instrumentation/vertx/vertx-redis-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/redis/RedisStandaloneConnectionInstrumentation.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ public void transform(TypeTransformer transformer) {
4242
@SuppressWarnings("unused")
4343
public static class SendAdvice {
4444
public static class AdviceScope {
45-
public VertxRedisClientRequest otelRequest;
46-
public Context context;
47-
public Scope scope;
45+
private final VertxRedisClientRequest otelRequest;
46+
private final Context context;
47+
private final Scope scope;
48+
49+
private AdviceScope(VertxRedisClientRequest otelRequest, Context context, Scope scope) {
50+
this.otelRequest = otelRequest;
51+
this.context = context;
52+
this.scope = scope;
53+
}
4854

4955
@Nullable
5056
public static AdviceScope start(
@@ -67,11 +73,8 @@ public static AdviceScope start(
6773
if (!instrumenter().shouldStart(parentContext, otelRequest)) {
6874
return null;
6975
}
70-
AdviceScope locals = new AdviceScope();
71-
locals.otelRequest = otelRequest;
72-
locals.context = instrumenter().start(parentContext, locals.otelRequest);
73-
locals.scope = locals.context.makeCurrent();
74-
return locals;
76+
Context context = instrumenter().start(parentContext, otelRequest);
77+
return new AdviceScope(otelRequest, context, context.makeCurrent());
7578
}
7679

7780
@Nullable

instrumentation/vertx/vertx-sql-client/vertx-sql-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/sql/QueryExecutorInstrumentation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static AdviceScope start(Object queryExecutor, Object[] arguments) {
104104
new VertxSqlClientRequest(sql, QueryExecutorUtil.getConnectOptions(queryExecutor));
105105
Context parentContext = Context.current();
106106
if (!instrumenter().shouldStart(parentContext, otelRequest)) {
107-
return new AdviceScope(callDepth, otelRequest, null, null);
107+
return new AdviceScope(callDepth, null, null, null);
108108
}
109109

110110
Context context = instrumenter().start(parentContext, otelRequest);

0 commit comments

Comments
 (0)