Skip to content

Commit 63aaf05

Browse files
committed
suggestions
1 parent be075a4 commit 63aaf05

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

dd-java-agent/instrumentation/akka/akka-actor-2.5/src/main/java/datadog/trace/instrumentation/akka/concurrent/AkkaActorCellInstrumentation.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ public void methodAdvice(MethodTransformer transformer) {
5757
*/
5858
public static class InvokeAdvice {
5959
@Advice.OnMethodEnter(suppress = Throwable.class)
60-
public static void enter(
60+
public static Context enter(
6161
@Advice.Argument(value = 0) Envelope envelope,
62-
@Advice.Local("taskScope") AgentScope taskScope,
63-
@Advice.Local("checkpointContext") Context checkpointContext) {
62+
@Advice.Local("taskScope") AgentScope taskScope) {
6463

6564
// do this before checkpointing, as the envelope's task scope may already be active
6665
taskScope =
@@ -70,15 +69,15 @@ public static void enter(
7069
if (InstrumenterConfig.get().isLegacyContextManagerEnabled()) {
7170
// remember the currently active scope so we can roll back to this point
7271
checkpointActiveForRollback();
72+
return null;
7373
} else {
74-
checkpointContext = getCurrentContext().swap();
74+
return getCurrentContext().swap();
7575
}
7676
}
7777

7878
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
7979
public static void exit(
80-
@Advice.Local("taskScope") AgentScope taskScope,
81-
@Advice.Local("checkpointContext") Context checkpointContext) {
80+
@Advice.Local("taskScope") AgentScope taskScope, @Advice.Enter Context checkpointContext) {
8281

8382
if (checkpointContext == null) {
8483
// Clean up any leaking scopes from akka-streams/akka-http etc.

dd-java-agent/instrumentation/pekko/pekko-concurrent-1.0/src/main/java/datadog/trace/instrumentation/pekko/concurrent/PekkoActorCellInstrumentation.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ public void methodAdvice(MethodTransformer transformer) {
5757
*/
5858
public static class InvokeAdvice {
5959
@Advice.OnMethodEnter(suppress = Throwable.class)
60-
public static void enter(
60+
public static Context enter(
6161
@Advice.Argument(value = 0) Envelope envelope,
62-
@Advice.Local("taskScope") AgentScope taskScope,
63-
@Advice.Local("checkpointContext") Context checkpointContext) {
62+
@Advice.Local("taskScope") AgentScope taskScope) {
6463

6564
// do this before checkpointing, as the envelope's task scope may already be active
6665
taskScope =
@@ -70,15 +69,15 @@ public static void enter(
7069
if (InstrumenterConfig.get().isLegacyContextManagerEnabled()) {
7170
// remember the currently active scope so we can roll back to this point
7271
checkpointActiveForRollback();
72+
return null;
7373
} else {
74-
checkpointContext = getCurrentContext().swap();
74+
return getCurrentContext().swap();
7575
}
7676
}
7777

7878
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
7979
public static void exit(
80-
@Advice.Local("taskScope") AgentScope taskScope,
81-
@Advice.Local("checkpointContext") Context checkpointContext) {
80+
@Advice.Local("taskScope") AgentScope taskScope, @Advice.Enter Context checkpointContext) {
8281

8382
if (checkpointContext == null) {
8483
// Clean up any leaking scopes from pekko-streams/pekko-http etc.

0 commit comments

Comments
 (0)