Skip to content

Commit 6f80861

Browse files
w2dp刘颖
andauthored
Fix an error status bug in the httpasyncclient plugin (#608)
Co-authored-by: 刘颖 <[email protected]>
1 parent 922a500 commit 6f80861

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Release Notes.
88
* Fix hbase onConstruct NPE in the file configuration scenario
99
* Fix the issue of createSpan failure caused by invalid request URL in HttpClient 4.x/5.x plugin
1010
* Optimize ElasticSearch 6.x 7.x plugin compatibility
11+
* Fix an issue with the httpasyncclient component where the isError state is incorrect.
1112

1213
#### Documentation
1314

apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/wrapper/HttpAsyncResponseConsumerWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public HttpAsyncResponseConsumerWrapper(HttpAsyncResponseConsumer<T> consumer) {
4646
public void responseReceived(HttpResponse response) throws IOException, HttpException {
4747
if (ContextManager.isActive()) {
4848
int statusCode = response.getStatusLine().getStatusCode();
49-
AbstractSpan span = ContextManager.activeSpan().errorOccurred();
49+
AbstractSpan span = ContextManager.activeSpan();
5050
Tags.HTTP_RESPONSE_STATUS_CODE.set(span, statusCode);
5151
if (statusCode >= 400) {
5252
span.errorOccurred();

apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/HttpAsyncClientInterceptorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ private void assertHttpSpan(AbstractTracingSpan span) {
348348
assertThat(tags.get(0).getValue(), is("http://localhost:8081/original/test"));
349349
assertThat(tags.get(1).getValue(), is("GET"));
350350
assertThat(tags.get(2).getValue(), is("a=1&b=test"));
351+
assertThat(span.transform().getIsError(), is(false));
351352
assertThat(span.isExit(), is(true));
352353
}
353354

test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ segmentItems:
6060
startTime: nq 0
6161
endTime: nq 0
6262
componentId: 26
63-
isError: true
63+
isError: false
6464
spanType: Exit
6565
peer: 127.0.0.1:8080
6666
tags:

0 commit comments

Comments
 (0)