2
2
3
3
import static datadog .trace .instrumentation .akkahttp .AkkaHttpClientDecorator .DECORATE ;
4
4
import static net .bytebuddy .matcher .ElementMatchers .named ;
5
- import static net .bytebuddy .matcher .ElementMatchers .returns ;
6
5
import static net .bytebuddy .matcher .ElementMatchers .takesArgument ;
7
6
8
- import akka .NotUsed ;
9
7
import akka .http .javadsl .model .headers .RawHeader ;
10
8
import akka .http .scaladsl .HttpExt ;
11
9
import akka .http .scaladsl .model .HttpRequest ;
12
10
import akka .http .scaladsl .model .HttpResponse ;
13
- import akka .stream .scaladsl .Flow ;
14
11
import com .google .auto .service .AutoService ;
15
12
import datadog .trace .agent .tooling .Instrumenter ;
16
13
import datadog .trace .bootstrap .CallDepthThreadLocalMap ;
27
24
import net .bytebuddy .description .method .MethodDescription ;
28
25
import net .bytebuddy .description .type .TypeDescription ;
29
26
import net .bytebuddy .matcher .ElementMatcher ;
30
- import scala .Tuple2 ;
31
27
import scala .concurrent .Future ;
32
28
import scala .runtime .AbstractFunction1 ;
33
29
import scala .util .Try ;
@@ -49,10 +45,6 @@ public String[] helperClassNames() {
49
45
return new String [] {
50
46
AkkaHttpClientInstrumentation .class .getName () + "$OnCompleteHandler" ,
51
47
AkkaHttpClientInstrumentation .class .getName () + "$AkkaHttpHeaders" ,
52
- packageName + ".AkkaHttpClientTransformFlow" ,
53
- packageName + ".AkkaHttpClientTransformFlow$" ,
54
- packageName + ".AkkaHttpClientTransformFlow$$anonfun$transform$1" ,
55
- packageName + ".AkkaHttpClientTransformFlow$$anonfun$transform$2" ,
56
48
"datadog.trace.agent.decorator.BaseDecorator" ,
57
49
"datadog.trace.agent.decorator.ClientDecorator" ,
58
50
"datadog.trace.agent.decorator.HttpClientDecorator" ,
@@ -72,14 +64,6 @@ public Map<? extends ElementMatcher<? super MethodDescription>, String> transfor
72
64
named ("singleRequestImpl" )
73
65
.and (takesArgument (0 , named ("akka.http.scaladsl.model.HttpRequest" ))),
74
66
SingleRequestAdvice .class .getName ());
75
- // This is mainly for compatibility with 10.0
76
- transformers .put (
77
- named ("superPool" ).and (returns (named ("akka.stream.scaladsl.Flow" ))),
78
- SuperPoolAdvice .class .getName ());
79
- // This is for 10.1+
80
- transformers .put (
81
- named ("superPoolImpl" ).and (returns (named ("akka.stream.scaladsl.Flow" ))),
82
- SuperPoolAdvice .class .getName ());
83
67
return transformers ;
84
68
}
85
69
@@ -108,7 +92,6 @@ public static Scope methodEnter(
108
92
// Request is immutable, so we have to assign new value once we update headers
109
93
request = headers .getRequest ();
110
94
}
111
-
112
95
return scope ;
113
96
}
114
97
@@ -137,34 +120,6 @@ public static void methodExit(
137
120
}
138
121
}
139
122
140
- public static class SuperPoolAdvice {
141
-
142
- @ Advice .OnMethodEnter (suppress = Throwable .class )
143
- public static boolean methodEnter () {
144
- /*
145
- Versions 10.0 and 10.1 have slightly different structure that is hard to distinguish so here
146
- we cast 'wider net' and avoid instrumenting twice.
147
- In the future we may want to separate these, but since lots of code is reused we would need to come up
148
- with way of continuing to reusing it.
149
- */
150
- final int callDepth = CallDepthThreadLocalMap .incrementCallDepth (HttpExt .class );
151
- return callDepth <= 0 ;
152
- }
153
-
154
- @ Advice .OnMethodExit (suppress = Throwable .class )
155
- public static <T > void methodExit (
156
- @ Advice .Return (readOnly = false )
157
- Flow <Tuple2 <HttpRequest , T >, Tuple2 <Try <HttpResponse >, T >, NotUsed > flow ,
158
- @ Advice .Enter final boolean isApplied ) {
159
- if (!isApplied ) {
160
- return ;
161
- }
162
- CallDepthThreadLocalMap .reset (HttpExt .class );
163
-
164
- flow = AkkaHttpClientTransformFlow .transform (flow );
165
- }
166
- }
167
-
168
123
public static class OnCompleteHandler extends AbstractFunction1 <Try <HttpResponse >, Void > {
169
124
private final Span span ;
170
125
0 commit comments