[JSON-API] Add metrics for ledger command submission timing (#10076)

changelog_begin

- [JSON-API] Timing metrics which measure how long the processing of a command submission request takes on the ledger are now available

changelog_end
This commit is contained in:
Victor Peter Rouven Müller 2021-06-22 17:59:23 +02:00 committed by GitHub
parent 7eb2ce72a9
commit 1f5aa4491c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View File

@ -217,7 +217,10 @@ class Endpoints(
_ <- EitherT.pure(parseAndDecodeTimerCtx.close())
ac <- eitherT(
handleFutureEitherFailure(commandService.create(jwt, jwtPayload, cmd))
Timed.future(
metrics.daml.HttpJsonApi.commandSubmissionLedgerTimer,
handleFutureEitherFailure(commandService.create(jwt, jwtPayload, cmd)),
)
): ET[domain.ActiveContract[ApiValue]]
} yield ac
}
@ -241,8 +244,11 @@ class Endpoints(
resolvedCmd = cmd.copy(argument = apiArg, reference = resolvedRef)
resp <- eitherT(
handleFutureEitherFailure(
commandService.exercise(jwt, jwtPayload, resolvedCmd)
Timed.future(
metrics.daml.HttpJsonApi.commandSubmissionLedgerTimer,
handleFutureEitherFailure(
commandService.exercise(jwt, jwtPayload, resolvedCmd)
),
)
): ET[domain.ExerciseResponse[ApiValue]]
@ -261,8 +267,11 @@ class Endpoints(
_ <- EitherT.pure(parseAndDecodeTimerCtx.close())
resp <- eitherT(
handleFutureEitherFailure(
commandService.createAndExercise(jwt, jwtPayload, cmd)
Timed.future(
metrics.daml.HttpJsonApi.commandSubmissionLedgerTimer,
handleFutureEitherFailure(
commandService.createAndExercise(jwt, jwtPayload, cmd)
),
)
): ET[domain.ExerciseResponse[ApiValue]]
} yield resp

View File

@ -731,6 +731,9 @@ final class Metrics(val registry: MetricRegistry) {
val dbFindByContractKey: Timer = registry.timer(Prefix :+ "db_find_by_contract_key_timing")
// Meters how long a find by contract id database operation takes
val dbFindByContractId: Timer = registry.timer(Prefix :+ "db_find_by_contract_id_timing")
// Meters how long processing of the command submission request takes on the ledger
val commandSubmissionLedgerTimer: Timer =
registry.timer(Prefix :+ "command_submission_ledger_timing")
// Meters http requests throughput
val httpRequestThroughput: Meter = registry.meter(Prefix :+ "http_request_throughput")
// Meters how many websocket connections are currently active