@@ -34,8 +34,10 @@ public static final <T> T runBlocking(CoroutineContext context, Function2<? supe
34
34
String name = Utils .getCoroutineName (context );
35
35
if (name != null ) {
36
36
NewRelic .getAgent ().getTracedMethod ().setMetricName ("Custom" ,"Builders" ,"runBlocking" ,name );
37
+ NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("CoroutineName" , name );
37
38
} else {
38
39
NewRelic .getAgent ().getTracedMethod ().setMetricName ("Custom" ,"Builders" ,"runBlocking" );
40
+ NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("CoroutineName" , "Could not determine" );
39
41
}
40
42
NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("Block" , block .toString ());
41
43
@@ -50,14 +52,18 @@ public static final <T> T runBlocking(CoroutineContext context, Function2<? supe
50
52
@ Trace (dispatcher = true )
51
53
public static final <T > Deferred <T > async (CoroutineScope scope , CoroutineContext context , CoroutineStart cStart , Function2 <? super CoroutineScope , ? super Continuation <? super T >, ? extends Object > block ) {
52
54
if (!Utils .ignoreScope (scope )) {
55
+ NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("CoroutineStart" , cStart .name ());
56
+ NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("CoroutineScope-Class" , scope .getClass ().getName ());
53
57
String name = Utils .getCoroutineName (context );
54
58
if (name == null ) {
55
59
name = Utils .getCoroutineName (scope .getCoroutineContext ());
56
60
}
57
61
if (name != null ) {
58
62
NewRelic .getAgent ().getTracedMethod ().setMetricName ("Custom" ,"Builders" ,"async" ,name );
63
+ NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("CoroutineName" , name );
59
64
} else {
60
65
NewRelic .getAgent ().getTracedMethod ().setMetricName ("Custom" ,"Builders" ,"async" );
66
+ NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("CoroutineName" , "Could not determine" );
61
67
}
62
68
63
69
Token token = Utils .getToken (context );
@@ -111,8 +117,10 @@ public static final kotlinx.coroutines.Job launch(CoroutineScope scope, Coroutin
111
117
}
112
118
if (name != null ) {
113
119
NewRelic .getAgent ().getTracedMethod ().setMetricName ("Custom" , "Builders" , "launch" , name );
120
+ NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("CoroutineName" , name );
114
121
} else {
115
122
NewRelic .getAgent ().getTracedMethod ().setMetricName ("Custom" , "Builders" , "launch" );
123
+ NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("CoroutineName" , "Could not determine" );
116
124
}
117
125
NewRelic .getAgent ().getTracedMethod ().addCustomAttribute ("Block" , block .toString ());
118
126
Token token = Utils .getToken (context );
0 commit comments