web_plsql 1.0.0 → 1.2.0
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 +5 -5
- package/package.json +5 -5
- package/src/admin/client/charts.ts +303 -4
- package/src/admin/index.html +283 -69
- package/src/admin/js/api.ts +95 -20
- package/src/admin/js/app.ts +460 -152
- package/src/admin/js/schemas.ts +76 -14
- package/src/admin/js/templates/config.ts +10 -9
- package/src/admin/js/templates/errorRow.ts +8 -5
- package/src/admin/js/templates/index.ts +1 -0
- package/src/admin/js/templates/poolCard.ts +6 -6
- package/src/admin/js/templates/traceRow.ts +24 -0
- package/src/admin/js/types.ts +132 -19
- package/src/admin/js/ui/components.ts +44 -0
- package/src/admin/js/ui/table.ts +173 -0
- package/src/admin/js/ui/views.ts +311 -48
- package/src/admin/js/util/format.ts +22 -3
- package/src/admin/js/util/metrics.ts +24 -0
- package/src/admin/lib/chart.bundle.css +1 -0
- package/src/admin/lib/chart.bundle.js +54 -47
- package/src/admin/style.css +143 -27
- package/src/handler/handlerAdmin.js +121 -26
- package/src/handler/plsql/errorPage.js +0 -4
- package/src/handler/plsql/owaPageStream.js +93 -0
- package/src/handler/plsql/procedure.js +191 -121
- package/src/handler/plsql/procedureNamed.js +17 -3
- package/src/handler/plsql/procedureSanitize.js +24 -0
- package/src/handler/plsql/procedureVariable.js +2 -0
- package/src/handler/plsql/sendResponse.js +41 -3
- package/src/index.js +0 -1
- package/src/server/adminContext.js +23 -0
- package/src/server/server.js +83 -68
- package/src/types.js +1 -1
- package/src/util/statsManager.js +368 -0
- package/src/util/trace.js +2 -1
- package/src/util/traceManager.js +68 -0
- package/src/version.js +1 -1
- package/types/admin/js/schemas.d.ts +384 -0
- package/types/admin/js/types.d.ts +312 -0
- package/types/handler/handlerAdmin.d.ts +70 -0
- package/types/handler/plsql/owaPageStream.d.ts +28 -0
- package/types/handler/plsql/procedure.d.ts +1 -0
- package/types/index.d.ts +0 -1
- package/types/server/adminContext.d.ts +17 -0
- package/types/server/server.d.ts +2 -19
- package/types/types.d.ts +1 -1
- package/types/util/statsManager.d.ts +395 -0
- package/types/util/traceManager.d.ts +35 -0
- package/src/admin/lib/assets/main-zpdhQ1gD.css +0 -1
- package/src/handler/handlerMetrics.js +0 -68
- package/types/handler/handlerMetrics.d.ts +0 -25
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import debugModule from 'debug';
|
|
2
|
-
const debug = debugModule('webplsql:handlerMetrics');
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import('express').RequestHandler} RequestHandler
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {object} metricsType
|
|
10
|
-
* @property {Date} started - When was the server started.
|
|
11
|
-
* @property {number} totalRequests - Total number of requests.
|
|
12
|
-
* @property {number} totalRequestDuration - Total amount of time in ms in request.
|
|
13
|
-
* @property {number} minRequestDuration - Min amount of time in ms in request.
|
|
14
|
-
* @property {number} maxRequestDuration - Max amount of time in ms in request.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Convert hrtime to ms.
|
|
19
|
-
* @param {[number, number]} hrtime - Time
|
|
20
|
-
* @returns {number} Millisecoinds.
|
|
21
|
-
*/
|
|
22
|
-
const hrtime2ms = (hrtime) => hrtime[0] * 1000 + hrtime[1] / 1_000_000;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* metrics initializer.
|
|
26
|
-
* @returns {metricsType} The metrics.
|
|
27
|
-
*/
|
|
28
|
-
export const initMetrics = () => {
|
|
29
|
-
return {
|
|
30
|
-
started: new Date(),
|
|
31
|
-
totalRequests: 0,
|
|
32
|
-
totalRequestDuration: 0,
|
|
33
|
-
minRequestDuration: -1,
|
|
34
|
-
maxRequestDuration: -1,
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The metrics handler.
|
|
40
|
-
* @param {metricsType} metrics - the nmetrics.
|
|
41
|
-
* @returns {RequestHandler} - Request handler.
|
|
42
|
-
*/
|
|
43
|
-
export const handlerMetrics = (metrics) => {
|
|
44
|
-
debug('register');
|
|
45
|
-
|
|
46
|
-
return (req, res, next) => {
|
|
47
|
-
metrics.totalRequests++;
|
|
48
|
-
|
|
49
|
-
const start = hrtime2ms(process.hrtime());
|
|
50
|
-
res.on('finish', () => {
|
|
51
|
-
const duration = hrtime2ms(process.hrtime()) - start;
|
|
52
|
-
|
|
53
|
-
metrics.totalRequestDuration += duration;
|
|
54
|
-
if (metrics.minRequestDuration < 0 || duration < metrics.minRequestDuration) {
|
|
55
|
-
metrics.minRequestDuration = duration;
|
|
56
|
-
}
|
|
57
|
-
if (metrics.maxRequestDuration < 0 || duration > metrics.maxRequestDuration) {
|
|
58
|
-
metrics.maxRequestDuration = duration;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (debug.enabled) {
|
|
62
|
-
debug(`Request to ${req.params?.name} ${req.url} took ${duration.toFixed(3)}ms`);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
next();
|
|
67
|
-
};
|
|
68
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export function initMetrics(): metricsType;
|
|
2
|
-
export function handlerMetrics(metrics: metricsType): RequestHandler;
|
|
3
|
-
export type RequestHandler = import("express").RequestHandler;
|
|
4
|
-
export type metricsType = {
|
|
5
|
-
/**
|
|
6
|
-
* - When was the server started.
|
|
7
|
-
*/
|
|
8
|
-
started: Date;
|
|
9
|
-
/**
|
|
10
|
-
* - Total number of requests.
|
|
11
|
-
*/
|
|
12
|
-
totalRequests: number;
|
|
13
|
-
/**
|
|
14
|
-
* - Total amount of time in ms in request.
|
|
15
|
-
*/
|
|
16
|
-
totalRequestDuration: number;
|
|
17
|
-
/**
|
|
18
|
-
* - Min amount of time in ms in request.
|
|
19
|
-
*/
|
|
20
|
-
minRequestDuration: number;
|
|
21
|
-
/**
|
|
22
|
-
* - Max amount of time in ms in request.
|
|
23
|
-
*/
|
|
24
|
-
maxRequestDuration: number;
|
|
25
|
-
};
|