Improve “upstream is not available” error to better understand what happened (#482)

* exclude Mono.empty() and write FullCause to response

* add test
Lower matcher type (#72)
This commit is contained in:
Anton
2024-05-29 13:37:32 +03:00
committed by GitHub
parent 387cd31c98
commit 5e35a8880d
4 changed files with 60 additions and 4 deletions

View File

@@ -229,7 +229,7 @@ class QuorumRequestReader(
private fun noResponse(method: String, q: CallQuorum): Mono<Result> {
return apiControl.upstreamsMatchesResponse()?.run {
tracer.currentSpan()?.tag(SPAN_NO_RESPONSE_MESSAGE, getFullCause())
val cause = getCause(method) ?: return Mono.empty()
val cause = getCause(method) ?: return Mono.error(RpcException(1, "No response for method $method", getFullCause()))
if (cause.shouldReturnNull) {
Mono.just(
Result(Global.nullValue, null, 1, null, null),

View File

@@ -27,9 +27,9 @@ class UpstreamsMatchesResponse {
}
}
fun getFullCause(): String? =
fun getFullCause() =
if (responses.isEmpty()) {
null
"Response is empty"
} else {
responses
.joinToString("; ") { "${it.upstreamId} - ${it.matchesResponse.getCause()}" }