Record Blink pool state around slow queries
This commit is contained in:
@@ -106,6 +106,9 @@ export class Database {
|
|||||||
operation: string,
|
operation: string,
|
||||||
query: () => Promise<T>,
|
query: () => Promise<T>,
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
|
const poolIdleConnectionsAtStart = this.cfg.pool.idleCount
|
||||||
|
const poolTotalConnectionsAtStart = this.cfg.pool.totalCount
|
||||||
|
const poolWaitingRequestsAtStart = this.cfg.pool.waitingCount
|
||||||
const startedAt = performance.now()
|
const startedAt = performance.now()
|
||||||
try {
|
try {
|
||||||
return await query()
|
return await query()
|
||||||
@@ -116,9 +119,12 @@ export class Database {
|
|||||||
{
|
{
|
||||||
durationMs,
|
durationMs,
|
||||||
operation,
|
operation,
|
||||||
poolIdleConnections: this.cfg.pool.idleCount,
|
poolIdleConnectionsAtEnd: this.cfg.pool.idleCount,
|
||||||
poolTotalConnections: this.cfg.pool.totalCount,
|
poolIdleConnectionsAtStart,
|
||||||
poolWaitingRequests: this.cfg.pool.waitingCount,
|
poolTotalConnectionsAtEnd: this.cfg.pool.totalCount,
|
||||||
|
poolTotalConnectionsAtStart,
|
||||||
|
poolWaitingRequestsAtEnd: this.cfg.pool.waitingCount,
|
||||||
|
poolWaitingRequestsAtStart,
|
||||||
},
|
},
|
||||||
'slow database query',
|
'slow database query',
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user