Skip to content

Commit

Permalink
core: log execution time when processing messages
Browse files Browse the repository at this point in the history
Signed-off-by: Eloi Charpentier <eloi.charpentier.42@gmail.com>
  • Loading branch information
eckter committed Nov 21, 2024
1 parent 6be0604 commit 0239b1e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/main/java/fr/sncf/osrd/cli/WorkerCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class WorkerCommand : CliCommand {
val channel = connection.createChannel()
val callback =
fun(message: Delivery) {
val startTimeMS = System.currentTimeMillis()
reportActivity(activityChannel, "request-received")

val replyTo = message.properties.replyTo
Expand Down Expand Up @@ -281,7 +282,12 @@ class WorkerCommand : CliCommand {
}

channel.basicAck(message.envelope.deliveryTag, false)
logger.info("request for path {} processed", path)
val executionTimeMS = System.currentTimeMillis() - startTimeMS
logger.info(
"request for path {} processed in {}s",
path,
executionTimeMS / 1_000.0
)
}
channel.basicConsume(
WORKER_REQUESTS_QUEUE,
Expand Down

0 comments on commit 0239b1e

Please sign in to comment.