1
0
mirror of https://github.com/google/nomulus synced 2026-01-06 13:36:48 +00:00

Log transaction durations (#2682)

There can be delays in releasing predicate locks when we have
transactions that are long-lived -- even delays in releasing predicate
locks acquired by shorter-lived transactions. Logging the transaction
duration will allow us to get a sense as to transaction durations during
busy times.
This commit is contained in:
gbrodman
2025-03-04 08:15:15 -05:00
committed by GitHub
parent 8896fb94f4
commit fa54c26ee2

View File

@@ -276,6 +276,10 @@ public class JpaTransactionManagerImpl implements JpaTransactionManager {
}
T result = work.call();
txn.commit();
long duration = clock.nowUtc().getMillis() - txnInfo.transactionTime.getMillis();
if (duration >= 100) {
logger.atInfo().log("Transaction duration: %d milliseconds", duration);
}
return result;
} catch (Throwable e) {
// Catch a Throwable here so even Errors would lead to a rollback.