Closed
Description
(This is a follow-on to #1382)
After testing the fix for #1382, the issue still persists, but it's moved to a different location. If the downstream service returns a non-standard status code (such as 499), an exception is thrown when Sleuth builds its on ClientResponse from the one supplied by WebFlux:
java.lang.IllegalArgumentException: No matching constant for [499]
at org.springframework.http.HttpStatus.valueOf(HttpStatus.java:527) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.http.client.reactive.ReactorClientHttpResponse.getStatusCode(ReactorClientHttpResponse.java:90) ~[spring-web-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.reactive.function.client.DefaultClientResponse.statusCode(DefaultClientResponse.java:75) ~[spring-webflux-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.reactive.function.client.DefaultClientResponseBuilder.<init>(DefaultClientResponseBuilder.java:64) ~[spring-webflux-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.web.reactive.function.client.ClientResponse.from(ClientResponse.java:174) ~[spring-webflux-5.1.8.RELEASE.jar:5.1.8.RELEASE]
at org.springframework.cloud.sleuth.instrument.web.client.TraceExchangeFilterFunction$MonoWebClientTrace$WebClientTracerSubscriber.onNext(TraceWebClientBeanPostProcessor.java:298) ~[spring-cloud-sleuth-core-2.2.0.BUILD-20190703.202916-634.jar:2.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.sleuth.instrument.web.client.TraceExchangeFilterFunction$MonoWebClientTrace$WebClientTracerSubscriber.onNext(TraceWebClientBeanPostProcessor.java:236) ~[spring-cloud-sleuth-core-2.2.0.BUILD-20190703.202916-634.jar:2.2.0.BUILD-SNAPSHOT]
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:96) ~[spring-cloud-sleuth-core-2.2.0.BUILD-20190703.202916-634.jar:2.2.0.BUILD-SNAPSHOT]
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE]
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:96) ~[spring-cloud-sleuth-core-2.2.0.BUILD-20190703.202916-634.jar:2.2.0.BUILD-SNAPSHOT]
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:192) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE]
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:96) ~[spring-cloud-sleuth-core-2.2.0.BUILD-20190703.202916-634.jar:2.2.0.BUILD-SNAPSHOT]
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:192) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE]
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:96) ~[spring-cloud-sleuth-core-2.2.0.BUILD-20190703.202916-634.jar:2.2.0.BUILD-SNAPSHOT]
at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:76) ~[reactor-core-3.2.10.RELEASE.jar:3.2.10.RELEASE]
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:96) ~[spring-cloud-sleuth-core-2.2.0.BUILD-20190703.202916-634.jar:2.2.0.BUILD-SNAPSHOT]
I have a sample project which demonstrates the issue at: https://github.com/blake-bauman/test-sleuth-unknown-status-code
Running this project and hitting the "/hello" endpoint will recreate the problem. If you remove the Sleuth dependency, it works fine.