mirror of
https://github.com/corda/corda.git
synced 2025-01-31 16:35:43 +00:00
Add flow-id to MDC
This commit is contained in:
parent
f1da044c86
commit
29dbe6ab53
@ -28,6 +28,7 @@ import net.corda.nodeapi.internal.persistence.contextTransaction
|
||||
import net.corda.nodeapi.internal.persistence.contextTransactionOrNull
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.slf4j.MDC
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.reflect.KProperty1
|
||||
|
||||
@ -164,11 +165,16 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
|
||||
}
|
||||
}
|
||||
|
||||
fun setLoggingContext() {
|
||||
context.pushToLoggingContext()
|
||||
MDC.put("flow-id", id.uuid.toString())
|
||||
}
|
||||
|
||||
@Suspendable
|
||||
override fun run() {
|
||||
logic.stateMachine = this
|
||||
|
||||
context.pushToLoggingContext()
|
||||
setLoggingContext()
|
||||
|
||||
initialiseFlow()
|
||||
|
||||
@ -321,6 +327,7 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
|
||||
require(continuation == FlowContinuation.ProcessEvents)
|
||||
Fiber.unparkDeserialized(this, scheduler)
|
||||
}
|
||||
setLoggingContext()
|
||||
return uncheckedCast(processEventsUntilFlowIsResumed(
|
||||
isDbTransactionOpenOnEntry = false,
|
||||
isDbTransactionOpenOnExit = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user