mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 14:38:50 +00:00
refactor(logger): non-debug query profiling
Use less precise query profiling (script based, rather than sql server based). Re-enables slow query warning, and reduces overhead when ui is enabled.
This commit is contained in:
1 parent
d0683b7f30
commit
e31d84019e
4 files changed
+30
-14
No files matched your search
@@ -1,9 +1,10 @@
|
||||
import { logError, profileBatchStatements, runProfiler } from '../logger';
|
||||
import { logError, logQuery, profileBatchStatements, runProfiler } from '../logger';
|
||||
import { CFXCallback, CFXParameters, QueryType } from '../types';
|
||||
import { parseResponse } from '../utils/parseResponse';
|
||||
import { executeType, parseExecute } from '../utils/parseExecute';
|
||||
import { getPoolConnection } from './connection';
|
||||
import { setCallback } from '../utils/setCallback';
|
||||
import { performance } from 'perf_hooks';
|
||||
|
||||
export const rawExecute = async (
|
||||
invokingResource: string,
|
||||
@@ -44,6 +45,7 @@ export const rawExecute = async (
|
||||
}
|
||||
}
|
||||
|
||||
const startTime = !hasProfiler && performance.now();
|
||||
const [result] = await connection.execute(query, values);
|
||||
|
||||
if (cb) {
|
||||
@@ -56,6 +58,8 @@ export const rawExecute = async (
|
||||
|
||||
if (hasProfiler && ((index > 0 && index % 100 === 0) || index === parametersLength - 1)) {
|
||||
await profileBatchStatements(connection, invokingResource, query, parameters, index < 100 ? 0 : index);
|
||||
} else if (startTime) {
|
||||
logQuery(invokingResource, query, performance.now() - startTime, values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user