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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user