Skip to content

Commit c0f2b1d

Browse files
committed
baseline
1 parent cb6a8e1 commit c0f2b1d

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

Kotlin-Coroutines_1.2/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ jar {
2222
}
2323

2424
verifyInstrumentation {
25-
passes 'org.jetbrains.kotlinx:kotlinx-coroutines-core:[1.2.0,1.3.0)'
25+
passes 'org.jetbrains.kotlinx:kotlinx-coroutines-core:[1.2.0,)'
2626
excludeRegex '.*SNAPSHOT'
2727
excludeRegex '.*alpha'
2828
excludeRegex '.*-eap-.*'
29+
excludeRegex '.*-native-.*'
2930
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package kotlinx.coroutines;
2+
3+
import com.newrelic.api.agent.NewRelic;
4+
import com.newrelic.api.agent.Token;
5+
import com.newrelic.api.agent.Trace;
6+
import com.newrelic.api.agent.weaver.MatchType;
7+
import com.newrelic.api.agent.weaver.NewField;
8+
import com.newrelic.api.agent.weaver.Weave;
9+
import com.newrelic.api.agent.weaver.Weaver;
10+
11+
@Weave(type=MatchType.BaseClass)
12+
public abstract class DispatchedTask<T> {
13+
14+
@NewField
15+
protected Token token = null;
16+
17+
public DispatchedTask(int mode) {
18+
if(token == null) {
19+
Token t = NewRelic.getAgent().getTransaction().getToken();
20+
if(t != null && t.isActive()) {
21+
token = t;
22+
} else if(t != null) {
23+
t.expire();
24+
t = null;
25+
}
26+
}
27+
}
28+
29+
@Trace(async=true)
30+
public void run() {
31+
if(token != null) {
32+
token.linkAndExpire();
33+
token = null;
34+
}
35+
Weaver.callOriginal();
36+
}
37+
38+
}

0 commit comments

Comments
 (0)