end spans on cancel

This commit is contained in:
a10zn8
2023-08-21 13:53:11 +04:00
parent 1562cc35c6
commit fd6f617ed2
2 changed files with 10 additions and 7 deletions

View File

@@ -33,16 +33,16 @@ class SpannedReader<K, D>(
return reader.read(key)
.contextWrite { ReactorSleuth.putSpanInScope(tracer, it, newSpan) }
.doOnError {
newSpan.apply {
tag(SPAN_ERROR, "true")
tag(SPAN_STATUS_MESSAGE, it.message)
end()
}
newSpan.tag(SPAN_ERROR, "true")
.tag(SPAN_STATUS_MESSAGE, it.message)
.end()
}
.doOnNext { newSpan.end() }
.doOnCancel {
newSpan.tag(SPAN_STATUS_MESSAGE, "cancelled").end()
}
.switchIfEmpty {
newSpan.tag(SPAN_READER_RESULT, "empty result")
newSpan.end()
newSpan.tag(SPAN_READER_RESULT, "empty result").end()
Mono.empty()
}
}

View File

@@ -124,6 +124,9 @@ open class NativeCall(
)
}
.doOnNext { callRes -> completeSpan(callRes, requestCount) }
.doOnCancel {
tracer.currentSpan()?.tag(SPAN_STATUS_MESSAGE, "cancel")?.end()
}
.contextWrite { ctx -> createTracingReactorContext(ctx, requestCount, requestId, requestSpan) }
}
}