fix: fix spring gateway plugin npe (#7389)
This commit is contained in:
parent
1f28d2036a
commit
b74778f0f4
|
|
@ -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 -> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue