diff --git a/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt b/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt index 61f4266ed1..d14f50f93b 100644 --- a/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt +++ b/core/src/main/kotlin/net/corda/core/flows/FlowLogic.kt @@ -310,12 +310,14 @@ abstract class FlowLogic { @Suspendable @JvmOverloads open fun receiveAllMap(sessions: Map>, maySkipCheckpoint: Boolean = false): Map> { - enforceNoPrimitiveInReceive(sessions.values) - val replies = stateMachine.suspend( - ioRequest = FlowIORequest.Receive(sessions.keys.toNonEmptySet()), - maySkipCheckpoint = maySkipCheckpoint - ) - return replies.mapValues { (session, payload) -> payload.checkPayloadIs(sessions[session]!!) } + serviceHub.telemetryServiceInternal.span("${this::class.java.name}#receiveAllMap") { + enforceNoPrimitiveInReceive(sessions.values) + val replies = stateMachine.suspend( + ioRequest = FlowIORequest.Receive(sessions.keys.toNonEmptySet()), + maySkipCheckpoint = maySkipCheckpoint + ) + return replies.mapValues { (session, payload) -> payload.checkPayloadIs(sessions[session]!!) } + } } /** @@ -332,9 +334,11 @@ abstract class FlowLogic { @Suspendable @JvmOverloads open fun receiveAll(receiveType: Class, sessions: List, maySkipCheckpoint: Boolean = false): List> { - enforceNoPrimitiveInReceive(listOf(receiveType)) - enforceNoDuplicates(sessions) - return castMapValuesToKnownType(receiveAllMap(associateSessionsToReceiveType(receiveType, sessions))) + serviceHub.telemetryServiceInternal.span("${this::class.java.name}#receiveAll") { + enforceNoPrimitiveInReceive(listOf(receiveType)) + enforceNoDuplicates(sessions) + return castMapValuesToKnownType(receiveAllMap(associateSessionsToReceiveType(receiveType, sessions))) + } } /** @@ -351,8 +355,10 @@ abstract class FlowLogic { @Suspendable @JvmOverloads fun sendAll(payload: Any, sessions: Set, maySkipCheckpoint: Boolean = false) { - val sessionToPayload = sessions.map { it to payload }.toMap() - return sendAllMap(sessionToPayload, maySkipCheckpoint) + serviceHub.telemetryServiceInternal.span("${this::class.java.name}#sendAll") { + val sessionToPayload = sessions.map { it to payload }.toMap() + return sendAllMap(sessionToPayload, maySkipCheckpoint) + } } /** @@ -368,10 +374,12 @@ abstract class FlowLogic { @Suspendable @JvmOverloads fun sendAllMap(payloadsPerSession: Map, maySkipCheckpoint: Boolean = false) { - val request = FlowIORequest.Send( - sessionToMessage = stateMachine.serialize(payloadsPerSession) - ) - stateMachine.suspend(request, maySkipCheckpoint) + serviceHub.telemetryServiceInternal.span("${this::class.java.name}#sendAllMap") { + val request = FlowIORequest.Send( + sessionToMessage = stateMachine.serialize(payloadsPerSession) + ) + stateMachine.suspend(request, maySkipCheckpoint) + } } /**