未验证 提交 b74778f0 编写于 作者: W wallezhang 提交者: GitHub

fix: fix spring gateway plugin npe (#7389)

上级 1f28d203
......@@ -41,6 +41,7 @@ Release Notes.
* Remove the logic of generating instance name in `KafkaServiceManagementServiceClient` class.
* Improve `okhttp` plugin performance by optimizing Class.getDeclaredField().
* Fix `GRPCLogClientAppender` no context warning.
* Fix `spring-webflux-5.x-webclient-plugin` NPE.
#### OAP-Backend
......
......@@ -34,7 +34,6 @@ import reactor.core.publisher.Mono;
import java.lang.reflect.Method;
import java.net.URI;
import java.util.function.BiConsumer;
public class WebFluxWebClientInterceptor implements InstanceMethodsAroundInterceptorV2 {
......@@ -79,15 +78,12 @@ public class WebFluxWebClientInterceptor implements InstanceMethodsAroundInterce
}
Mono<ClientResponse> ret1 = (Mono<ClientResponse>) ret;
AbstractSpan span = (AbstractSpan) context.getContext();
return ret1.doAfterSuccessOrError(new BiConsumer<ClientResponse, Throwable>() {
@Override
public void accept(ClientResponse clientResponse, Throwable throwable) {
HttpStatus httpStatus = clientResponse.statusCode();
if (httpStatus != null) {
Tags.STATUS_CODE.set(span, Integer.toString(httpStatus.value()));
if (httpStatus.isError()) {
span.errorOccurred();
}
return ret1.doOnSuccess(clientResponse -> {
HttpStatus httpStatus = clientResponse.statusCode();
if (httpStatus != null) {
Tags.STATUS_CODE.set(span, Integer.toString(httpStatus.value()));
if (httpStatus.isError()) {
span.errorOccurred();
}
}
}).doOnError(error -> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册