mirror of
https://github.com/corda/corda.git
synced 2025-01-18 18:56:28 +00:00
CORDA-1695 Include thread ID in flow logging MDC (#3463)
This commit is contained in:
parent
e2f657d679
commit
a768904e4e
@ -115,12 +115,14 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
|
|||||||
*/
|
*/
|
||||||
@Suspendable
|
@Suspendable
|
||||||
private fun processEvent(transitionExecutor: TransitionExecutor, event: Event): FlowContinuation {
|
private fun processEvent(transitionExecutor: TransitionExecutor, event: Event): FlowContinuation {
|
||||||
|
setLoggingContext()
|
||||||
val stateMachine = getTransientField(TransientValues::stateMachine)
|
val stateMachine = getTransientField(TransientValues::stateMachine)
|
||||||
val oldState = transientState!!.value
|
val oldState = transientState!!.value
|
||||||
val actionExecutor = getTransientField(TransientValues::actionExecutor)
|
val actionExecutor = getTransientField(TransientValues::actionExecutor)
|
||||||
val transition = stateMachine.transition(event, oldState)
|
val transition = stateMachine.transition(event, oldState)
|
||||||
val (continuation, newState) = transitionExecutor.executeTransition(this, oldState, event, transition, actionExecutor)
|
val (continuation, newState) = transitionExecutor.executeTransition(this, oldState, event, transition, actionExecutor)
|
||||||
transientState = TransientReference(newState)
|
transientState = TransientReference(newState)
|
||||||
|
setLoggingContext()
|
||||||
return continuation
|
return continuation
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,6 +198,7 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
|
|||||||
context.pushToLoggingContext()
|
context.pushToLoggingContext()
|
||||||
MDC.put("flow-id", id.uuid.toString())
|
MDC.put("flow-id", id.uuid.toString())
|
||||||
MDC.put("fiber-id", this.getId().toString())
|
MDC.put("fiber-id", this.getId().toString())
|
||||||
|
MDC.put("thread-id", Thread.currentThread().id.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suspendable
|
@Suspendable
|
||||||
@ -353,6 +356,7 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
|
|||||||
val serializationContext = TransientReference(getTransientField(TransientValues::checkpointSerializationContext))
|
val serializationContext = TransientReference(getTransientField(TransientValues::checkpointSerializationContext))
|
||||||
val transaction = extractThreadLocalTransaction()
|
val transaction = extractThreadLocalTransaction()
|
||||||
parkAndSerialize { _, _ ->
|
parkAndSerialize { _, _ ->
|
||||||
|
setLoggingContext()
|
||||||
logger.trace { "Suspended on $ioRequest" }
|
logger.trace { "Suspended on $ioRequest" }
|
||||||
|
|
||||||
// Will skip checkpoint if there are any idempotent flows in the subflow stack.
|
// Will skip checkpoint if there are any idempotent flows in the subflow stack.
|
||||||
@ -379,7 +383,6 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
|
|||||||
require(continuation == FlowContinuation.ProcessEvents)
|
require(continuation == FlowContinuation.ProcessEvents)
|
||||||
unpark(SERIALIZER_BLOCKER)
|
unpark(SERIALIZER_BLOCKER)
|
||||||
}
|
}
|
||||||
setLoggingContext()
|
|
||||||
return uncheckedCast(processEventsUntilFlowIsResumed(
|
return uncheckedCast(processEventsUntilFlowIsResumed(
|
||||||
isDbTransactionOpenOnEntry = false,
|
isDbTransactionOpenOnEntry = false,
|
||||||
isDbTransactionOpenOnExit = true
|
isDbTransactionOpenOnExit = true
|
||||||
|
Loading…
Reference in New Issue
Block a user