generated from newrelic-experimental/java-instrumentation-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from newrelic/undispatched
Fixed "Unable to ignore UndispatchedCoroutine"
- Loading branch information
Showing
17 changed files
with
305 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
..._1.2/src/main/java/com/newrelic/instrumentation/kotlin/coroutines/NRFunction1Wrapper.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...routines_1.2/src/main/java/com/newrelic/instrumentation/kotlin/coroutines/NRRunnable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.newrelic.instrumentation.kotlin.coroutines; | ||
|
||
import com.newrelic.agent.bridge.AgentBridge; | ||
import com.newrelic.api.agent.Token; | ||
import com.newrelic.api.agent.Trace; | ||
|
||
public class NRRunnable implements Runnable { | ||
|
||
private Runnable delegate = null; | ||
private Token token = null; | ||
private static boolean isTransformed = false; | ||
|
||
public NRRunnable(Runnable r,Token t) { | ||
if(!isTransformed) { | ||
AgentBridge.instrumentation.retransformUninstrumentedClass(getClass()); | ||
isTransformed = true; | ||
} | ||
delegate = r; | ||
token = t; | ||
} | ||
|
||
@Override | ||
@Trace(async = true) | ||
public void run() { | ||
if(token != null) { | ||
token.linkAndExpire(); | ||
token = null; | ||
} | ||
if(delegate != null) { | ||
delegate.run(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Kotlin-Coroutines_1.2/src/main/java/kotlinx/coroutines/CoroutineDispatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package kotlinx.coroutines; | ||
|
||
import com.newrelic.api.agent.Trace; | ||
import com.newrelic.api.agent.weaver.MatchType; | ||
import com.newrelic.api.agent.weaver.Weave; | ||
import com.newrelic.api.agent.weaver.Weaver; | ||
import com.newrelic.instrumentation.kotlin.coroutines.NRRunnable; | ||
import com.newrelic.instrumentation.kotlin.coroutines.Utils; | ||
|
||
import kotlin.coroutines.CoroutineContext; | ||
|
||
@Weave(type = MatchType.BaseClass) | ||
public abstract class CoroutineDispatcher { | ||
|
||
@Trace | ||
public void dispatch(CoroutineContext ctx, Runnable r) { | ||
NRRunnable wrapper = Utils.getRunnableWrapper(r); | ||
if(wrapper != null) { | ||
r = wrapper; | ||
} | ||
|
||
Weaver.callOriginal(); | ||
} | ||
} |
37 changes: 0 additions & 37 deletions
37
Kotlin-Coroutines_1.3/src/main/java/kotlinx/coroutines/DispatchedTask.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.