Add response upstreamId to span (#203)

This commit is contained in:
KirillPamPam
2023-04-18 15:48:29 +04:00
committed by GitHub
parent 75c6deb6a0
commit bdff5b8ae9
2 changed files with 5 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ const val SPAN_STATUS_MESSAGE = "status.message"
const val SPAN_READER_RESULT = "reader.result"
const val SPAN_REQUEST_API_TYPE = "request.api.type"
const val SPAN_REQUEST_UPSTREAM_ID = "request.upstreamId"
const val SPAN_RESPONSE_UPSTREAM_ID = "response.upstreamId"
const val SPAN_REQUEST_ID = "request.id"
const val LOCAL_READER = "localReader"

View File

@@ -27,6 +27,7 @@ import io.emeraldpay.dshackle.commons.LOCAL_READER
import io.emeraldpay.dshackle.commons.REMOTE_QUORUM_RPC_READER
import io.emeraldpay.dshackle.commons.SPAN_ERROR
import io.emeraldpay.dshackle.commons.SPAN_REQUEST_ID
import io.emeraldpay.dshackle.commons.SPAN_RESPONSE_UPSTREAM_ID
import io.emeraldpay.dshackle.commons.SPAN_STATUS_MESSAGE
import io.emeraldpay.dshackle.config.MainConfig
import io.emeraldpay.dshackle.quorum.CallQuorum
@@ -133,6 +134,9 @@ open class NativeCall(
private fun completeSpan(callResult: CallResult, requestCount: Int) {
val span = tracer.currentSpan()
callResult.upstreamId?.let {
span?.tag(SPAN_RESPONSE_UPSTREAM_ID, it)
}
if (callResult.isError()) {
errorSpan(span, callResult.error?.message ?: "Internal error")
}