forge-sql-orm 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +205 -0
- package/dist/ForgeSQLORM.js +598 -2
- package/dist/ForgeSQLORM.js.map +1 -1
- package/dist/ForgeSQLORM.mjs +601 -5
- package/dist/ForgeSQLORM.mjs.map +1 -1
- package/dist/core/SystemTables.d.ts +5039 -0
- package/dist/core/SystemTables.d.ts.map +1 -1
- package/dist/webtriggers/applyMigrationsWebTrigger.d.ts +1 -1
- package/dist/webtriggers/applyMigrationsWebTrigger.d.ts.map +1 -1
- package/dist/webtriggers/index.d.ts +1 -0
- package/dist/webtriggers/index.d.ts.map +1 -1
- package/dist/webtriggers/topSlowestStatementLastHourTrigger.d.ts +72 -0
- package/dist/webtriggers/topSlowestStatementLastHourTrigger.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/core/SystemTables.ts +313 -1
- package/src/webtriggers/applyMigrationsWebTrigger.ts +5 -3
- package/src/webtriggers/index.ts +1 -0
- package/src/webtriggers/topSlowestStatementLastHourTrigger.ts +305 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemTables.d.ts","sourceRoot":"","sources":["../../src/core/SystemTables.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SystemTables.d.ts","sourceRoot":"","sources":["../../src/core/SystemTables.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrB,CAAC;AAIH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,8BAA8B,EAAE,MAAM,CAAC;IACvC,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAGnD;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,EAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyMigrationsWebTrigger.d.ts","sourceRoot":"","sources":["../../src/webtriggers/applyMigrationsWebTrigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,GAChC,WAAW,CAAC,eAAe,EAAE,eAAe,KAAK,OAAO,CAAC,eAAe,CAAC;;;;;;;
|
|
1
|
+
{"version":3,"file":"applyMigrationsWebTrigger.d.ts","sourceRoot":"","sources":["../../src/webtriggers/applyMigrationsWebTrigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,GAChC,WAAW,CAAC,eAAe,EAAE,eAAe,KAAK,OAAO,CAAC,eAAe,CAAC;;;;;;;EAmD1E,CAAC"}
|
|
@@ -3,6 +3,7 @@ export * from "./applyMigrationsWebTrigger";
|
|
|
3
3
|
export * from "./fetchSchemaWebTrigger";
|
|
4
4
|
export * from "./dropTablesMigrationWebTrigger";
|
|
5
5
|
export * from "./clearCacheSchedulerTrigger";
|
|
6
|
+
export * from "./topSlowestStatementLastHourTrigger";
|
|
6
7
|
export interface TriggerResponse<BODY> {
|
|
7
8
|
body?: BODY;
|
|
8
9
|
headers?: Record<string, string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webtriggers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webtriggers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AAErD,MAAM,WAAW,eAAe,CAAC,IAAI;IACnC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,GAAI,IAAI,EAAE,YAAY,MAAM,EAAE,MAAM,IAAI,KAAG,eAAe,CAAC,IAAI,CAc1F,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ForgeSqlOperation } from "../core/ForgeSQLQueryBuilder";
|
|
2
|
+
/**
|
|
3
|
+
* Scheduler trigger: log and return the single slowest statement from the last hour, filtered by latency OR memory usage.
|
|
4
|
+
*
|
|
5
|
+
* When scheduled (e.g. hourly), this trigger queries
|
|
6
|
+
* INFORMATION_SCHEMA.CLUSTER_STATEMENTS_SUMMARY_HISTORY for the last hour
|
|
7
|
+
* and prints the TOP 1 entry (by AVG_LATENCY) if it exceeds either threshold.
|
|
8
|
+
*
|
|
9
|
+
* **OR Logic**: Statements are included if they exceed EITHER threshold:
|
|
10
|
+
* - avgLatencyMs > warnThresholdMs OR
|
|
11
|
+
* - avgMemBytes > memoryThresholdBytes
|
|
12
|
+
*
|
|
13
|
+
* **Pro Tips:**
|
|
14
|
+
* - Memory-only monitoring: Set warnThresholdMs to 10000ms (effectively disabled)
|
|
15
|
+
* - Latency-only monitoring: Set memoryThresholdBytes to 16MB (16 * 1024 * 1024) (effectively disabled)
|
|
16
|
+
* - Combined monitoring: Use both thresholds for comprehensive monitoring
|
|
17
|
+
*
|
|
18
|
+
* Excludes statements with empty `digestText`, empty `digest`, or service statements (`Use`, `Set`, `Show`).
|
|
19
|
+
*
|
|
20
|
+
* Logging rule:
|
|
21
|
+
* - Query exceeds warnThresholdMs OR memoryThresholdBytes → console.warn (logged)
|
|
22
|
+
* - otherwise → not logged
|
|
23
|
+
*
|
|
24
|
+
* @param orm ForgeSQL ORM instance (required)
|
|
25
|
+
* @param warnThresholdMs Milliseconds threshold for logging and filtering (default: 300ms)
|
|
26
|
+
* @param memoryThresholdBytes Bytes threshold for average memory usage (default: 8MB)
|
|
27
|
+
* @returns HTTP response with a JSON payload containing the filtered rows
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import ForgeSQL, { topSlowestStatementLastHourTrigger } from "forge-sql-orm";
|
|
32
|
+
*
|
|
33
|
+
* const FORGE_SQL_ORM = new ForgeSQL();
|
|
34
|
+
*
|
|
35
|
+
* // Default thresholds: 300ms latency OR 8MB memory
|
|
36
|
+
* export const topSlowQueryTrigger = () =>
|
|
37
|
+
* topSlowestStatementLastHourTrigger(FORGE_SQL_ORM);
|
|
38
|
+
*
|
|
39
|
+
* // Only latency monitoring: 500ms threshold (memory effectively disabled)
|
|
40
|
+
* export const latencyOnlyTrigger = () =>
|
|
41
|
+
* topSlowestStatementLastHourTrigger(FORGE_SQL_ORM, 500, 16 * 1024 * 1024);
|
|
42
|
+
*
|
|
43
|
+
* // Only memory monitoring: 4MB threshold (latency effectively disabled)
|
|
44
|
+
* export const memoryOnlyTrigger = () =>
|
|
45
|
+
* topSlowestStatementLastHourTrigger(FORGE_SQL_ORM, 10000, 4 * 1024 * 1024);
|
|
46
|
+
*
|
|
47
|
+
* // Both thresholds: 500ms latency OR 8MB memory
|
|
48
|
+
* export const bothThresholdsTrigger = () =>
|
|
49
|
+
* topSlowestStatementLastHourTrigger(FORGE_SQL_ORM, 500, 8 * 1024 * 1024);
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```yaml
|
|
54
|
+
* scheduledTrigger:
|
|
55
|
+
* - key: top-slow-query-trigger
|
|
56
|
+
* function: topSlowQueryTrigger
|
|
57
|
+
* interval: hour
|
|
58
|
+
*
|
|
59
|
+
* function:
|
|
60
|
+
* - key: topSlowQueryTrigger
|
|
61
|
+
* handler: index.topSlowQueryTrigger
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const topSlowestStatementLastHourTrigger: (orm: ForgeSqlOperation, warnThresholdMs?: number, memoryThresholdBytes?: number) => Promise<{
|
|
65
|
+
headers: {
|
|
66
|
+
"Content-Type": string[];
|
|
67
|
+
};
|
|
68
|
+
statusCode: number;
|
|
69
|
+
statusText: string;
|
|
70
|
+
body: string;
|
|
71
|
+
}>;
|
|
72
|
+
//# sourceMappingURL=topSlowestStatementLastHourTrigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topSlowestStatementLastHourTrigger.d.ts","sourceRoot":"","sources":["../../src/webtriggers/topSlowestStatementLastHourTrigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAMjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,eAAO,MAAM,kCAAkC,GAC7C,KAAK,iBAAiB,EAEtB,kBAAiB,MAAY,EAE7B,uBAAsB,MAAwB;;;;;;;EAsO/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forge-sql-orm",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Drizzle ORM integration for Atlassian @forge/sql. Provides a custom driver, schema migration, two levels of caching (local and global via @forge/kvs), optimistic locking, and query analysis.",
|
|
5
5
|
"main": "dist/ForgeSQLORM.js",
|
|
6
6
|
"module": "dist/ForgeSQLORM.mjs",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"database"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@eslint/js": "^9.
|
|
35
|
+
"@eslint/js": "^9.36.0",
|
|
36
36
|
"@types/luxon": "^3.7.1",
|
|
37
37
|
"@types/node": "^24.5.2",
|
|
38
38
|
"@typescript-eslint/eslint-plugin": "^8.44.0",
|
|
39
39
|
"@typescript-eslint/parser": "^8.44.0",
|
|
40
40
|
"@vitest/coverage-v8": "^3.2.4",
|
|
41
41
|
"@vitest/ui": "^3.2.4",
|
|
42
|
-
"eslint": "^9.
|
|
42
|
+
"eslint": "^9.36.0",
|
|
43
43
|
"eslint-config-prettier": "^10.1.8",
|
|
44
44
|
"eslint-plugin-import": "^2.32.0",
|
|
45
45
|
"eslint-plugin-vitest": "^0.5.4",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"lint": "eslint src --ext .ts,.tsx",
|
|
61
61
|
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
62
62
|
"format": "prettier --write src examples __tests__",
|
|
63
|
+
"format:check": "prettier --write src examples __tests__ --check",
|
|
63
64
|
"clean": "rm -rf dist",
|
|
64
65
|
"build": "npm run clean && vite build && npm run build:types",
|
|
65
66
|
"build:types": "tsc --emitDeclarationOnly",
|
package/src/core/SystemTables.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
bigint,
|
|
3
|
+
mysqlTable,
|
|
4
|
+
timestamp,
|
|
5
|
+
varchar,
|
|
6
|
+
double,
|
|
7
|
+
mysqlSchema,
|
|
8
|
+
longtext,
|
|
9
|
+
int,
|
|
10
|
+
text,
|
|
11
|
+
boolean,
|
|
12
|
+
} from "drizzle-orm/mysql-core";
|
|
2
13
|
import { Table } from "drizzle-orm";
|
|
3
14
|
import { sql } from "@forge/sql";
|
|
4
15
|
|
|
@@ -8,6 +19,307 @@ export const migrations = mysqlTable("__migrations", {
|
|
|
8
19
|
migratedAt: timestamp("migratedAt").defaultNow().notNull(),
|
|
9
20
|
});
|
|
10
21
|
|
|
22
|
+
const informationSchema = mysqlSchema("information_schema");
|
|
23
|
+
|
|
24
|
+
export const slowQuery = informationSchema.table("SLOW_QUERY", {
|
|
25
|
+
time: timestamp("Time", { fsp: 6, mode: "string" }).notNull(), // Timestamp when the slow query was recorded
|
|
26
|
+
|
|
27
|
+
txnStartTs: bigint("Txn_start_ts", { mode: "bigint", unsigned: true }), // Transaction start timestamp (TSO)
|
|
28
|
+
user: varchar("User", { length: 64 }), // User executing the query
|
|
29
|
+
host: varchar("Host", { length: 64 }), // Host from which the query originated
|
|
30
|
+
connId: bigint("Conn_ID", { mode: "bigint", unsigned: true }), // Connection ID
|
|
31
|
+
sessionAlias: varchar("Session_alias", { length: 64 }), // Session alias
|
|
32
|
+
|
|
33
|
+
execRetryCount: bigint("Exec_retry_count", { mode: "bigint", unsigned: true }), // Number of retries during execution
|
|
34
|
+
execRetryTime: double("Exec_retry_time"), // Time spent in retries
|
|
35
|
+
queryTime: double("Query_time"), // Total execution time
|
|
36
|
+
parseTime: double("Parse_time"), // Time spent parsing SQL
|
|
37
|
+
compileTime: double("Compile_time"), // Time spent compiling query plan
|
|
38
|
+
rewriteTime: double("Rewrite_time"), // Time spent rewriting query
|
|
39
|
+
preprocSubqueries: bigint("Preproc_subqueries", { mode: "bigint", unsigned: true }), // Number of subqueries preprocessed
|
|
40
|
+
preprocSubqueriesTime: double("Preproc_subqueries_time"), // Time spent preprocessing subqueries
|
|
41
|
+
optimizeTime: double("Optimize_time"), // Time spent in optimizer
|
|
42
|
+
waitTs: double("Wait_TS"), // Wait time for getting TSO
|
|
43
|
+
prewriteTime: double("Prewrite_time"), // Time spent in prewrite phase
|
|
44
|
+
waitPrewriteBinlogTime: double("Wait_prewrite_binlog_time"), // Time waiting for binlog prewrite
|
|
45
|
+
commitTime: double("Commit_time"), // Commit duration
|
|
46
|
+
getCommitTsTime: double("Get_commit_ts_time"), // Time waiting for commit TSO
|
|
47
|
+
commitBackoffTime: double("Commit_backoff_time"), // Backoff time during commit
|
|
48
|
+
backoffTypes: varchar("Backoff_types", { length: 64 }), // Types of backoff occurred
|
|
49
|
+
resolveLockTime: double("Resolve_lock_time"), // Time resolving locks
|
|
50
|
+
localLatchWaitTime: double("Local_latch_wait_time"), // Time waiting on local latch
|
|
51
|
+
|
|
52
|
+
writeKeys: bigint("Write_keys", { mode: "bigint" }), // Number of keys written
|
|
53
|
+
writeSize: bigint("Write_size", { mode: "bigint" }), // Amount of data written
|
|
54
|
+
prewriteRegion: bigint("Prewrite_region", { mode: "bigint" }), // Regions involved in prewrite
|
|
55
|
+
txnRetry: bigint("Txn_retry", { mode: "bigint" }), // Transaction retry count
|
|
56
|
+
|
|
57
|
+
copTime: double("Cop_time"), // Time spent in coprocessor
|
|
58
|
+
processTime: double("Process_time"), // Processing time
|
|
59
|
+
waitTime: double("Wait_time"), // Wait time in TiKV
|
|
60
|
+
backoffTime: double("Backoff_time"), // Backoff wait time
|
|
61
|
+
lockKeysTime: double("LockKeys_time"), // Time spent waiting for locks
|
|
62
|
+
|
|
63
|
+
requestCount: bigint("Request_count", { mode: "bigint", unsigned: true }), // Total number of requests
|
|
64
|
+
totalKeys: bigint("Total_keys", { mode: "bigint", unsigned: true }), // Total keys scanned
|
|
65
|
+
processKeys: bigint("Process_keys", { mode: "bigint", unsigned: true }), // Keys processed
|
|
66
|
+
|
|
67
|
+
rocksdbDeleteSkippedCount: bigint("Rocksdb_delete_skipped_count", {
|
|
68
|
+
mode: "bigint",
|
|
69
|
+
unsigned: true,
|
|
70
|
+
}), // RocksDB delete skips
|
|
71
|
+
rocksdbKeySkippedCount: bigint("Rocksdb_key_skipped_count", { mode: "bigint", unsigned: true }), // RocksDB key skips
|
|
72
|
+
rocksdbBlockCacheHitCount: bigint("Rocksdb_block_cache_hit_count", {
|
|
73
|
+
mode: "bigint",
|
|
74
|
+
unsigned: true,
|
|
75
|
+
}), // RocksDB block cache hits
|
|
76
|
+
rocksdbBlockReadCount: bigint("Rocksdb_block_read_count", { mode: "bigint", unsigned: true }), // RocksDB block reads
|
|
77
|
+
rocksdbBlockReadByte: bigint("Rocksdb_block_read_byte", { mode: "bigint", unsigned: true }), // RocksDB block read bytes
|
|
78
|
+
|
|
79
|
+
db: varchar("DB", { length: 64 }), // Database name
|
|
80
|
+
indexNames: varchar("Index_names", { length: 100 }), // Indexes used
|
|
81
|
+
|
|
82
|
+
isInternal: boolean("Is_internal"), // Whether the query is internal
|
|
83
|
+
digest: varchar("Digest", { length: 64 }), // SQL digest hash
|
|
84
|
+
stats: varchar("Stats", { length: 512 }), // Stats used during planning
|
|
85
|
+
|
|
86
|
+
copProcAvg: double("Cop_proc_avg"), // Coprocessor average processing time
|
|
87
|
+
copProcP90: double("Cop_proc_p90"), // Coprocessor 90th percentile processing time
|
|
88
|
+
copProcMax: double("Cop_proc_max"), // Coprocessor max processing time
|
|
89
|
+
copProcAddr: varchar("Cop_proc_addr", { length: 64 }), // Coprocessor address for processing
|
|
90
|
+
|
|
91
|
+
copWaitAvg: double("Cop_wait_avg"), // Coprocessor average wait time
|
|
92
|
+
copWaitP90: double("Cop_wait_p90"), // Coprocessor 90th percentile wait time
|
|
93
|
+
copWaitMax: double("Cop_wait_max"), // Coprocessor max wait time
|
|
94
|
+
copWaitAddr: varchar("Cop_wait_addr", { length: 64 }), // Coprocessor address for wait
|
|
95
|
+
|
|
96
|
+
memMax: bigint("Mem_max", { mode: "bigint" }), // Max memory usage
|
|
97
|
+
diskMax: bigint("Disk_max", { mode: "bigint" }), // Max disk usage
|
|
98
|
+
|
|
99
|
+
kvTotal: double("KV_total"), // Total KV request time
|
|
100
|
+
pdTotal: double("PD_total"), // Total PD request time
|
|
101
|
+
backoffTotal: double("Backoff_total"), // Total backoff time
|
|
102
|
+
writeSqlResponseTotal: double("Write_sql_response_total"), // SQL response write time
|
|
103
|
+
|
|
104
|
+
resultRows: bigint("Result_rows", { mode: "bigint" }), // Rows returned
|
|
105
|
+
warnings: longtext("Warnings"), // Warnings during execution
|
|
106
|
+
backoffDetail: varchar("Backoff_Detail", { length: 4096 }), // Detailed backoff info
|
|
107
|
+
|
|
108
|
+
prepared: boolean("Prepared"), // Whether query was prepared
|
|
109
|
+
succ: boolean("Succ"), // Success flag
|
|
110
|
+
isExplicitTxn: boolean("IsExplicitTxn"), // Whether explicit transaction
|
|
111
|
+
isWriteCacheTable: boolean("IsWriteCacheTable"), // Whether wrote to cache table
|
|
112
|
+
planFromCache: boolean("Plan_from_cache"), // Plan was from cache
|
|
113
|
+
planFromBinding: boolean("Plan_from_binding"), // Plan was from binding
|
|
114
|
+
hasMoreResults: boolean("Has_more_results"), // Query returned multiple results
|
|
115
|
+
|
|
116
|
+
resourceGroup: varchar("Resource_group", { length: 64 }), // Resource group name
|
|
117
|
+
requestUnitRead: double("Request_unit_read"), // RU consumed for read
|
|
118
|
+
requestUnitWrite: double("Request_unit_write"), // RU consumed for write
|
|
119
|
+
timeQueuedByRc: double("Time_queued_by_rc"), // Time queued by resource control
|
|
120
|
+
|
|
121
|
+
tidbCpuTime: double("Tidb_cpu_time"), // TiDB CPU time
|
|
122
|
+
tikvCpuTime: double("Tikv_cpu_time"), // TiKV CPU time
|
|
123
|
+
|
|
124
|
+
plan: longtext("Plan"), // Query execution plan
|
|
125
|
+
planDigest: varchar("Plan_digest", { length: 128 }), // Plan digest hash
|
|
126
|
+
binaryPlan: longtext("Binary_plan"), // Binary execution plan
|
|
127
|
+
prevStmt: longtext("Prev_stmt"), // Previous statement in session
|
|
128
|
+
query: longtext("Query"), // Original SQL query
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export type SlowQuery = typeof slowQuery.$inferSelect;
|
|
132
|
+
|
|
133
|
+
// Common schema for cluster statements summary tables
|
|
134
|
+
const createClusterStatementsSummarySchema = () => ({
|
|
135
|
+
instance: varchar("INSTANCE", { length: 64 }), // TiDB/TiKV instance address
|
|
136
|
+
|
|
137
|
+
summaryBeginTime: timestamp("SUMMARY_BEGIN_TIME", { mode: "string" }).notNull(), // Begin time of this summary window
|
|
138
|
+
summaryEndTime: timestamp("SUMMARY_END_TIME", { mode: "string" }).notNull(), // End time of this summary window
|
|
139
|
+
|
|
140
|
+
stmtType: varchar("STMT_TYPE", { length: 64 }).notNull(), // Statement type (e.g., Select/Insert/Update)
|
|
141
|
+
schemaName: varchar("SCHEMA_NAME", { length: 64 }), // Current schema name
|
|
142
|
+
digest: varchar("DIGEST", { length: 64 }), // SQL digest (normalized hash)
|
|
143
|
+
digestText: text("DIGEST_TEXT").notNull(), // Normalized SQL text
|
|
144
|
+
|
|
145
|
+
tableNames: text("TABLE_NAMES"), // Involved table names
|
|
146
|
+
indexNames: text("INDEX_NAMES"), // Used index names
|
|
147
|
+
|
|
148
|
+
sampleUser: varchar("SAMPLE_USER", { length: 64 }), // Sampled user who executed the statements
|
|
149
|
+
|
|
150
|
+
execCount: bigint("EXEC_COUNT", { mode: "bigint", unsigned: true }).notNull(), // Total executions
|
|
151
|
+
sumErrors: int("SUM_ERRORS", { unsigned: true }).notNull(), // Sum of errors
|
|
152
|
+
sumWarnings: int("SUM_WARNINGS", { unsigned: true }).notNull(), // Sum of warnings
|
|
153
|
+
|
|
154
|
+
sumLatency: bigint("SUM_LATENCY", { mode: "bigint", unsigned: true }).notNull(), // Sum of latency (ns)
|
|
155
|
+
maxLatency: bigint("MAX_LATENCY", { mode: "bigint", unsigned: true }).notNull(), // Max latency (ns)
|
|
156
|
+
minLatency: bigint("MIN_LATENCY", { mode: "bigint", unsigned: true }).notNull(), // Min latency (ns)
|
|
157
|
+
avgLatency: bigint("AVG_LATENCY", { mode: "bigint", unsigned: true }).notNull(), // Avg latency (ns)
|
|
158
|
+
|
|
159
|
+
avgParseLatency: bigint("AVG_PARSE_LATENCY", { mode: "bigint", unsigned: true }).notNull(), // Avg parse time (ns)
|
|
160
|
+
maxParseLatency: bigint("MAX_PARSE_LATENCY", { mode: "bigint", unsigned: true }).notNull(), // Max parse time (ns)
|
|
161
|
+
avgCompileLatency: bigint("AVG_COMPILE_LATENCY", { mode: "bigint", unsigned: true }).notNull(), // Avg compile time (ns)
|
|
162
|
+
maxCompileLatency: bigint("MAX_COMPILE_LATENCY", { mode: "bigint", unsigned: true }).notNull(), // Max compile time (ns)
|
|
163
|
+
|
|
164
|
+
sumCopTaskNum: bigint("SUM_COP_TASK_NUM", { mode: "bigint", unsigned: true }).notNull(), // Total number of cop tasks
|
|
165
|
+
maxCopProcessTime: bigint("MAX_COP_PROCESS_TIME", { mode: "bigint", unsigned: true }).notNull(), // Max TiKV coprocessor processing time (ns)
|
|
166
|
+
maxCopProcessAddress: varchar("MAX_COP_PROCESS_ADDRESS", { length: 256 }), // Address of cop task with max processing time
|
|
167
|
+
maxCopWaitTime: bigint("MAX_COP_WAIT_TIME", { mode: "bigint", unsigned: true }).notNull(), // Max TiKV coprocessor wait time (ns)
|
|
168
|
+
maxCopWaitAddress: varchar("MAX_COP_WAIT_ADDRESS", { length: 256 }), // Address of cop task with max wait time
|
|
169
|
+
|
|
170
|
+
avgProcessTime: bigint("AVG_PROCESS_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg TiKV processing time (ns)
|
|
171
|
+
maxProcessTime: bigint("MAX_PROCESS_TIME", { mode: "bigint", unsigned: true }).notNull(), // Max TiKV processing time (ns)
|
|
172
|
+
avgWaitTime: bigint("AVG_WAIT_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg TiKV wait time (ns)
|
|
173
|
+
maxWaitTime: bigint("MAX_WAIT_TIME", { mode: "bigint", unsigned: true }).notNull(), // Max TiKV wait time (ns)
|
|
174
|
+
|
|
175
|
+
avgBackoffTime: bigint("AVG_BACKOFF_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg backoff time before retry (ns)
|
|
176
|
+
maxBackoffTime: bigint("MAX_BACKOFF_TIME", { mode: "bigint", unsigned: true }).notNull(), // Max backoff time before retry (ns)
|
|
177
|
+
|
|
178
|
+
avgTotalKeys: bigint("AVG_TOTAL_KEYS", { mode: "bigint", unsigned: true }).notNull(), // Avg scanned keys
|
|
179
|
+
maxTotalKeys: bigint("MAX_TOTAL_KEYS", { mode: "bigint", unsigned: true }).notNull(), // Max scanned keys
|
|
180
|
+
avgProcessedKeys: bigint("AVG_PROCESSED_KEYS", { mode: "bigint", unsigned: true }).notNull(), // Avg processed keys
|
|
181
|
+
maxProcessedKeys: bigint("MAX_PROCESSED_KEYS", { mode: "bigint", unsigned: true }).notNull(), // Max processed keys
|
|
182
|
+
|
|
183
|
+
avgRocksdbDeleteSkippedCount: double("AVG_ROCKSDB_DELETE_SKIPPED_COUNT").notNull(), // Avg RocksDB deletes skipped
|
|
184
|
+
maxRocksdbDeleteSkippedCount: int("MAX_ROCKSDB_DELETE_SKIPPED_COUNT", {
|
|
185
|
+
unsigned: true,
|
|
186
|
+
}).notNull(), // Max RocksDB deletes skipped
|
|
187
|
+
avgRocksdbKeySkippedCount: double("AVG_ROCKSDB_KEY_SKIPPED_COUNT").notNull(), // Avg RocksDB keys skipped
|
|
188
|
+
maxRocksdbKeySkippedCount: int("MAX_ROCKSDB_KEY_SKIPPED_COUNT", { unsigned: true }).notNull(), // Max RocksDB keys skipped
|
|
189
|
+
avgRocksdbBlockCacheHitCount: double("AVG_ROCKSDB_BLOCK_CACHE_HIT_COUNT").notNull(), // Avg RocksDB block cache hits
|
|
190
|
+
maxRocksdbBlockCacheHitCount: int("MAX_ROCKSDB_BLOCK_CACHE_HIT_COUNT", {
|
|
191
|
+
unsigned: true,
|
|
192
|
+
}).notNull(), // Max RocksDB block cache hits
|
|
193
|
+
avgRocksdbBlockReadCount: double("AVG_ROCKSDB_BLOCK_READ_COUNT").notNull(), // Avg RocksDB block reads
|
|
194
|
+
maxRocksdbBlockReadCount: int("MAX_ROCKSDB_BLOCK_READ_COUNT", { unsigned: true }).notNull(), // Max RocksDB block reads
|
|
195
|
+
avgRocksdbBlockReadByte: double("AVG_ROCKSDB_BLOCK_READ_BYTE").notNull(), // Avg RocksDB block read bytes
|
|
196
|
+
maxRocksdbBlockReadByte: int("MAX_ROCKSDB_BLOCK_READ_BYTE", { unsigned: true }).notNull(), // Max RocksDB block read bytes
|
|
197
|
+
|
|
198
|
+
avgPrewriteTime: bigint("AVG_PREWRITE_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg prewrite phase time (ns)
|
|
199
|
+
maxPrewriteTime: bigint("MAX_PREWRITE_TIME", { mode: "bigint", unsigned: true }).notNull(), // Max prewrite phase time (ns)
|
|
200
|
+
avgCommitTime: bigint("AVG_COMMIT_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg commit phase time (ns)
|
|
201
|
+
maxCommitTime: bigint("MAX_COMMIT_TIME", { mode: "bigint", unsigned: true }).notNull(), // Max commit phase time (ns)
|
|
202
|
+
avgGetCommitTsTime: bigint("AVG_GET_COMMIT_TS_TIME", {
|
|
203
|
+
mode: "bigint",
|
|
204
|
+
unsigned: true,
|
|
205
|
+
}).notNull(), // Avg get commit_ts time (ns)
|
|
206
|
+
maxGetCommitTsTime: bigint("MAX_GET_COMMIT_TS_TIME", {
|
|
207
|
+
mode: "bigint",
|
|
208
|
+
unsigned: true,
|
|
209
|
+
}).notNull(), // Max get commit_ts time (ns)
|
|
210
|
+
avgCommitBackoffTime: bigint("AVG_COMMIT_BACKOFF_TIME", {
|
|
211
|
+
mode: "bigint",
|
|
212
|
+
unsigned: true,
|
|
213
|
+
}).notNull(), // Avg backoff during commit (ns)
|
|
214
|
+
maxCommitBackoffTime: bigint("MAX_COMMIT_BACKOFF_TIME", {
|
|
215
|
+
mode: "bigint",
|
|
216
|
+
unsigned: true,
|
|
217
|
+
}).notNull(), // Max backoff during commit (ns)
|
|
218
|
+
avgResolveLockTime: bigint("AVG_RESOLVE_LOCK_TIME", {
|
|
219
|
+
mode: "bigint",
|
|
220
|
+
unsigned: true,
|
|
221
|
+
}).notNull(), // Avg resolve lock time (ns)
|
|
222
|
+
maxResolveLockTime: bigint("MAX_RESOLVE_LOCK_TIME", {
|
|
223
|
+
mode: "bigint",
|
|
224
|
+
unsigned: true,
|
|
225
|
+
}).notNull(), // Max resolve lock time (ns)
|
|
226
|
+
avgLocalLatchWaitTime: bigint("AVG_LOCAL_LATCH_WAIT_TIME", {
|
|
227
|
+
mode: "bigint",
|
|
228
|
+
unsigned: true,
|
|
229
|
+
}).notNull(), // Avg local latch wait (ns)
|
|
230
|
+
maxLocalLatchWaitTime: bigint("MAX_LOCAL_LATCH_WAIT_TIME", {
|
|
231
|
+
mode: "bigint",
|
|
232
|
+
unsigned: true,
|
|
233
|
+
}).notNull(), // Max local latch wait (ns)
|
|
234
|
+
|
|
235
|
+
avgWriteKeys: double("AVG_WRITE_KEYS").notNull(), // Avg number of written keys
|
|
236
|
+
maxWriteKeys: bigint("MAX_WRITE_KEYS", { mode: "bigint", unsigned: true }).notNull(), // Max written keys
|
|
237
|
+
avgWriteSize: double("AVG_WRITE_SIZE").notNull(), // Avg written bytes
|
|
238
|
+
maxWriteSize: bigint("MAX_WRITE_SIZE", { mode: "bigint", unsigned: true }).notNull(), // Max written bytes
|
|
239
|
+
avgPrewriteRegions: double("AVG_PREWRITE_REGIONS").notNull(), // Avg regions in prewrite
|
|
240
|
+
maxPrewriteRegions: int("MAX_PREWRITE_REGIONS", { unsigned: true }).notNull(), // Max regions in prewrite
|
|
241
|
+
avgTxnRetry: double("AVG_TXN_RETRY").notNull(), // Avg transaction retry count
|
|
242
|
+
maxTxnRetry: int("MAX_TXN_RETRY", { unsigned: true }).notNull(), // Max transaction retry count
|
|
243
|
+
|
|
244
|
+
sumExecRetry: bigint("SUM_EXEC_RETRY", { mode: "bigint", unsigned: true }).notNull(), // Sum of execution retries (pessimistic)
|
|
245
|
+
sumExecRetryTime: bigint("SUM_EXEC_RETRY_TIME", { mode: "bigint", unsigned: true }).notNull(), // Sum time of execution retries (ns)
|
|
246
|
+
sumBackoffTimes: bigint("SUM_BACKOFF_TIMES", { mode: "bigint", unsigned: true }).notNull(), // Sum of backoff retries
|
|
247
|
+
backoffTypes: varchar("BACKOFF_TYPES", { length: 1024 }), // Backoff types with counts
|
|
248
|
+
|
|
249
|
+
avgMem: bigint("AVG_MEM", { mode: "bigint", unsigned: true }).notNull(), // Avg memory used (bytes)
|
|
250
|
+
maxMem: bigint("MAX_MEM", { mode: "bigint", unsigned: true }).notNull(), // Max memory used (bytes)
|
|
251
|
+
avgDisk: bigint("AVG_DISK", { mode: "bigint", unsigned: true }).notNull(), // Avg disk used (bytes)
|
|
252
|
+
maxDisk: bigint("MAX_DISK", { mode: "bigint", unsigned: true }).notNull(), // Max disk used (bytes)
|
|
253
|
+
|
|
254
|
+
avgKvTime: bigint("AVG_KV_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg time spent in TiKV (ns)
|
|
255
|
+
avgPdTime: bigint("AVG_PD_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg time spent in PD (ns)
|
|
256
|
+
avgBackoffTotalTime: bigint("AVG_BACKOFF_TOTAL_TIME", {
|
|
257
|
+
mode: "bigint",
|
|
258
|
+
unsigned: true,
|
|
259
|
+
}).notNull(), // Avg total backoff time (ns)
|
|
260
|
+
avgWriteSqlRespTime: bigint("AVG_WRITE_SQL_RESP_TIME", {
|
|
261
|
+
mode: "bigint",
|
|
262
|
+
unsigned: true,
|
|
263
|
+
}).notNull(), // Avg write SQL response time (ns)
|
|
264
|
+
|
|
265
|
+
avgTidbCpuTime: bigint("AVG_TIDB_CPU_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg TiDB CPU time (ns)
|
|
266
|
+
avgTikvCpuTime: bigint("AVG_TIKV_CPU_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg TiKV CPU time (ns)
|
|
267
|
+
|
|
268
|
+
maxResultRows: bigint("MAX_RESULT_ROWS", { mode: "bigint" }).notNull(), // Max number of result rows
|
|
269
|
+
minResultRows: bigint("MIN_RESULT_ROWS", { mode: "bigint" }).notNull(), // Min number of result rows
|
|
270
|
+
avgResultRows: bigint("AVG_RESULT_ROWS", { mode: "bigint" }).notNull(), // Avg number of result rows
|
|
271
|
+
|
|
272
|
+
prepared: boolean("PREPARED").notNull(), // Whether statements are prepared
|
|
273
|
+
avgAffectedRows: double("AVG_AFFECTED_ROWS").notNull(), // Avg affected rows
|
|
274
|
+
|
|
275
|
+
firstSeen: timestamp("FIRST_SEEN", { mode: "string" }).notNull(), // First time statements observed
|
|
276
|
+
lastSeen: timestamp("LAST_SEEN", { mode: "string" }).notNull(), // Last time statements observed
|
|
277
|
+
|
|
278
|
+
planInCache: boolean("PLAN_IN_CACHE").notNull(), // Whether last stmt hit plan cache
|
|
279
|
+
planCacheHits: bigint("PLAN_CACHE_HITS", { mode: "bigint" }).notNull(), // Number of plan cache hits
|
|
280
|
+
planInBinding: boolean("PLAN_IN_BINDING").notNull(), // Whether matched bindings
|
|
281
|
+
|
|
282
|
+
querySampleText: text("QUERY_SAMPLE_TEXT"), // Sampled original SQL
|
|
283
|
+
prevSampleText: text("PREV_SAMPLE_TEXT"), // Sampled previous SQL before commit
|
|
284
|
+
|
|
285
|
+
planDigest: varchar("PLAN_DIGEST", { length: 64 }), // Plan digest hash
|
|
286
|
+
plan: text("PLAN"), // Sampled textual plan
|
|
287
|
+
binaryPlan: text("BINARY_PLAN"), // Sampled binary plan
|
|
288
|
+
|
|
289
|
+
charset: varchar("CHARSET", { length: 64 }), // Sampled charset
|
|
290
|
+
collation: varchar("COLLATION", { length: 64 }), // Sampled collation
|
|
291
|
+
planHint: varchar("PLAN_HINT", { length: 64 }), // Sampled plan hint
|
|
292
|
+
|
|
293
|
+
maxRequestUnitRead: double("MAX_REQUEST_UNIT_READ").notNull(), // Max RU cost (read)
|
|
294
|
+
avgRequestUnitRead: double("AVG_REQUEST_UNIT_READ").notNull(), // Avg RU cost (read)
|
|
295
|
+
maxRequestUnitWrite: double("MAX_REQUEST_UNIT_WRITE").notNull(), // Max RU cost (write)
|
|
296
|
+
avgRequestUnitWrite: double("AVG_REQUEST_UNIT_WRITE").notNull(), // Avg RU cost (write)
|
|
297
|
+
|
|
298
|
+
maxQueuedRcTime: bigint("MAX_QUEUED_RC_TIME", { mode: "bigint", unsigned: true }).notNull(), // Max queued time waiting for RU (ns)
|
|
299
|
+
avgQueuedRcTime: bigint("AVG_QUEUED_RC_TIME", { mode: "bigint", unsigned: true }).notNull(), // Avg queued time waiting for RU (ns)
|
|
300
|
+
|
|
301
|
+
resourceGroup: varchar("RESOURCE_GROUP", { length: 64 }), // Bound resource group name
|
|
302
|
+
|
|
303
|
+
planCacheUnqualified: bigint("PLAN_CACHE_UNQUALIFIED", { mode: "bigint" }).notNull(), // Times not eligible for plan cache
|
|
304
|
+
planCacheUnqualifiedLastReason: text("PLAN_CACHE_UNQUALIFIED_LAST_REASON"), // Last reason of plan cache ineligibility
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
export const clusterStatementsSummaryHistory = informationSchema.table(
|
|
308
|
+
"CLUSTER_STATEMENTS_SUMMARY_HISTORY",
|
|
309
|
+
createClusterStatementsSummarySchema(),
|
|
310
|
+
);
|
|
311
|
+
|
|
312
|
+
// Types
|
|
313
|
+
export type ClusterStatementsSummaryHistory = typeof clusterStatementsSummaryHistory.$inferSelect;
|
|
314
|
+
|
|
315
|
+
export const clusterStatementsSummary = informationSchema.table(
|
|
316
|
+
"CLUSTER_STATEMENTS_SUMMARY",
|
|
317
|
+
createClusterStatementsSummarySchema(),
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
// Types
|
|
321
|
+
export type ClusterStatementsSummary = typeof clusterStatementsSummary.$inferSelect;
|
|
322
|
+
|
|
11
323
|
export interface ExplainAnalyzeRow {
|
|
12
324
|
id: string;
|
|
13
325
|
estRows?: string;
|
|
@@ -62,8 +62,10 @@ export const applySchemaMigrations = async (
|
|
|
62
62
|
};
|
|
63
63
|
} catch (error: any) {
|
|
64
64
|
const errorMessage =
|
|
65
|
-
error?.debug?.sqlMessage ??
|
|
66
|
-
error?.debug?.message ??
|
|
65
|
+
error?.cause?.context?.debug?.sqlMessage ??
|
|
66
|
+
error?.cause?.context?.debug?.message ??
|
|
67
|
+
error?.debug?.context?.sqlMessage ??
|
|
68
|
+
error?.debug?.context?.message ??
|
|
67
69
|
error.message ??
|
|
68
70
|
"Unknown error occurred";
|
|
69
71
|
console.error("Error during migration:", errorMessage);
|
|
@@ -71,7 +73,7 @@ export const applySchemaMigrations = async (
|
|
|
71
73
|
headers: { "Content-Type": ["application/json"] },
|
|
72
74
|
statusCode: 500,
|
|
73
75
|
statusText: "Internal Server Error",
|
|
74
|
-
body: error instanceof Error ?
|
|
76
|
+
body: error instanceof Error ? errorMessage : "Unknown error during migration",
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
79
|
};
|
package/src/webtriggers/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./applyMigrationsWebTrigger";
|
|
|
3
3
|
export * from "./fetchSchemaWebTrigger";
|
|
4
4
|
export * from "./dropTablesMigrationWebTrigger";
|
|
5
5
|
export * from "./clearCacheSchedulerTrigger";
|
|
6
|
+
export * from "./topSlowestStatementLastHourTrigger";
|
|
6
7
|
|
|
7
8
|
export interface TriggerResponse<BODY> {
|
|
8
9
|
body?: BODY;
|