AG-323 Flow startup queue metric (#6811)

This commit is contained in:
Stefan Iliev 2020-11-30 16:49:08 +00:00 committed by GitHub
parent 5a13e48ea8
commit 2c25a5c768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -29,7 +29,11 @@ import java.time.Duration
* @param etaThreshold If the ETA for processing the request, according to the service, is greater than this, notify the client.
*/
// See AbstractStateReplacementFlow.Acceptor for why it's Void?
abstract class NotaryServiceFlow(val otherSideSession: FlowSession, val service: SinglePartyNotaryService, private val etaThreshold: Duration) : FlowLogic<Void?>(), IdempotentFlow {
abstract class NotaryServiceFlow(
val otherSideSession: FlowSession,
val service: SinglePartyNotaryService,
private val etaThreshold: Duration
) : FlowLogic<Void?>(), IdempotentFlow {
companion object {
// TODO: Determine an appropriate limit and also enforce in the network parameters and the transaction builder.
private const val maxAllowedInputsAndReferences = 10_000

View File

@ -62,6 +62,7 @@ import org.apache.activemq.artemis.utils.ReusableLatch
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.slf4j.MDC
import java.time.Duration
import java.util.concurrent.TimeUnit
class FlowPermissionException(message: String) : FlowException(message)
@ -333,6 +334,9 @@ class FlowStateMachineImpl<R>(override val id: StateMachineRunId,
logger.debug { "Calling flow: $logic" }
val startTime = System.nanoTime()
serviceHub.monitoringService.metrics
.timer("Flows.StartupQueueTime")
.update(Duration.ofNanos(startTime).toMillis() - creationTime, TimeUnit.MILLISECONDS)
var initialised = false
val resultOrError = try {