diff --git a/CHANGES.md b/CHANGES.md index cb5ac457a..87c8ea24b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ Release Notes. * Fix hbase onConstruct NPE in the file configuration scenario * Fix the issue of createSpan failure caused by invalid request URL in HttpClient 4.x/5.x plugin * Optimize ElasticSearch 6.x 7.x plugin compatibility +* Fix an issue with the httpasyncclient component where the isError state is incorrect. #### Documentation diff --git a/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/wrapper/HttpAsyncResponseConsumerWrapper.java b/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/wrapper/HttpAsyncResponseConsumerWrapper.java index b03ad6b80..bc0318c64 100644 --- a/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/wrapper/HttpAsyncResponseConsumerWrapper.java +++ b/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/wrapper/HttpAsyncResponseConsumerWrapper.java @@ -46,7 +46,7 @@ public class HttpAsyncResponseConsumerWrapper implements HttpAsyncResponseCon public void responseReceived(HttpResponse response) throws IOException, HttpException { if (ContextManager.isActive()) { int statusCode = response.getStatusLine().getStatusCode(); - AbstractSpan span = ContextManager.activeSpan().errorOccurred(); + AbstractSpan span = ContextManager.activeSpan(); Tags.HTTP_RESPONSE_STATUS_CODE.set(span, statusCode); if (statusCode >= 400) { span.errorOccurred(); diff --git a/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/HttpAsyncClientInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/HttpAsyncClientInterceptorTest.java index 0c334eea1..f99d63bf1 100644 --- a/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/HttpAsyncClientInterceptorTest.java +++ b/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/HttpAsyncClientInterceptorTest.java @@ -348,6 +348,7 @@ public class HttpAsyncClientInterceptorTest { assertThat(tags.get(0).getValue(), is("http://localhost:8081/original/test")); assertThat(tags.get(1).getValue(), is("GET")); assertThat(tags.get(2).getValue(), is("a=1&b=test")); + assertThat(span.transform().getIsError(), is(false)); assertThat(span.isExit(), is(true)); } diff --git a/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml index f41a91282..b26bbd892 100644 --- a/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml @@ -60,7 +60,7 @@ segmentItems: startTime: nq 0 endTime: nq 0 componentId: 26 - isError: true + isError: false spanType: Exit peer: 127.0.0.1:8080 tags: