Fix an error status bug in the httpasyncclient plugin (#608)

Co-authored-by: 刘颖 <liuying03196@51shebao.com>
This commit is contained in:
w2dp 2023-09-14 13:36:29 +08:00 committed by GitHub
parent 922a5001fa
commit 6f80861657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -46,7 +46,7 @@ public class HttpAsyncResponseConsumerWrapper<T> 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();

View File

@ -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));
}

View File

@ -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: