Skip to content

Commit 458c6ac

Browse files
committed
remove another copy of ApacheHttpClientHelper
1 parent 7b3d023 commit 458c6ac

File tree

3 files changed

+8
-30
lines changed

3 files changed

+8
-30
lines changed

instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientHelper.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientInstrumentation.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import net.bytebuddy.matcher.ElementMatcher;
2929
import org.apache.http.HttpHost;
3030
import org.apache.http.HttpRequest;
31+
import org.apache.http.HttpResponse;
3132
import org.apache.http.client.ResponseHandler;
3233
import org.apache.http.client.methods.HttpUriRequest;
3334

@@ -157,7 +158,12 @@ public <T> ResponseHandler<T> wrapHandler(ResponseHandler<T> handler) {
157158

158159
public void end(@Nullable Object result, @Nullable Throwable throwable) {
159160
scope.close();
160-
ApacheHttpClientHelper.doMethodExit(context, otelRequest, result, throwable);
161+
if (throwable != null) {
162+
instrumenter().end(context, otelRequest, null, throwable);
163+
} else if (result instanceof HttpResponse) {
164+
instrumenter().end(context, otelRequest, (HttpResponse) result, null);
165+
}
166+
// ended in WrappingStatusSettingResponseHandler
161167
}
162168
}
163169

instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientInstrumentation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ public void end(@Nullable Object result, @Nullable Throwable throwable) {
156156
instrumenter().end(context, request, null, throwable);
157157
} else if (result instanceof HttpResponse) {
158158
instrumenter().end(context, request, (HttpResponse) result, null);
159-
} else {
160-
// ended in WrappingStatusSettingResponseHandler
161159
}
160+
// ended in WrappingStatusSettingResponseHandler
162161
}
163162

164163
public WrappingStatusSettingResponseHandler<?> wrapResponseHandler(

0 commit comments

Comments
 (0)