@nsshunt/stsdatamanagement 1.4.1 → 1.6.1
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/package.json +4 -3
- package/pgpoolmanager.js +11 -9
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nsshunt/stsdatamanagement",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "STS Data Management Modules, Utilities and Services",
|
|
5
5
|
"main": "dbaccess.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@nsshunt/stsconfig": "^1.
|
|
8
|
-
"@nsshunt/
|
|
7
|
+
"@nsshunt/stsconfig": "^1.6.0",
|
|
8
|
+
"@nsshunt/stsinstrumentation": "^5.5.1",
|
|
9
|
+
"@nsshunt/stsutils": "^1.5.8",
|
|
9
10
|
"axios": "^0.24.0",
|
|
10
11
|
"bcryptjs": "^2.4.3",
|
|
11
12
|
"cli-progress": "^3.9.1",
|
package/pgpoolmanager.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const { databaseUrl, connectionString, defaultDatabaseConnectionString, isProduction, poolSize } = require('@nsshunt/stsconfig').$options;
|
|
2
|
+
const { Gauge } = require('@nsshunt/stsinstrumentation');
|
|
3
|
+
|
|
2
4
|
const debug = require('debug')(`proc:${process.pid}`);
|
|
3
5
|
require('colors');
|
|
4
6
|
const cluster = require('cluster');
|
|
@@ -96,13 +98,13 @@ class PGPoolManager
|
|
|
96
98
|
UpdateInstruments(poolManager)
|
|
97
99
|
{
|
|
98
100
|
if (poolManager.instruments !== null &&
|
|
99
|
-
typeof poolManager.instruments.
|
|
100
|
-
typeof poolManager.instruments.
|
|
101
|
-
typeof poolManager.instruments.
|
|
101
|
+
typeof poolManager.instruments[Gauge.CONNECTION_POOL_TOTAL_GAUGE] !== 'undefined' &&
|
|
102
|
+
typeof poolManager.instruments[Gauge.CONNECTION_POOL_IDLE_GAUGE] !== 'undefined' &&
|
|
103
|
+
typeof poolManager.instruments[Gauge.CONNECTION_POOL_WAITING_GAUGE] !== 'undefined')
|
|
102
104
|
{
|
|
103
|
-
poolManager.instruments.
|
|
104
|
-
poolManager.instruments.
|
|
105
|
-
poolManager.instruments.
|
|
105
|
+
poolManager.instruments[Gauge.CONNECTION_POOL_TOTAL_GAUGE].Val = poolManager.pool.totalCount;
|
|
106
|
+
poolManager.instruments[Gauge.CONNECTION_POOL_IDLE_GAUGE].Val = poolManager.pool.idleCount;
|
|
107
|
+
poolManager.instruments[Gauge.CONNECTION_POOL_WAITING_GAUGE].Val = poolManager.pool.waitingCount;
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
|
|
@@ -110,9 +112,9 @@ class PGPoolManager
|
|
|
110
112
|
{
|
|
111
113
|
this.#instruments = instruments;
|
|
112
114
|
if (instruments !== null &&
|
|
113
|
-
typeof instruments.
|
|
114
|
-
typeof instruments.
|
|
115
|
-
typeof instruments.
|
|
115
|
+
typeof instruments[Gauge.CONNECTION_POOL_TOTAL_GAUGE] !== 'undefined' &&
|
|
116
|
+
typeof instruments[Gauge.CONNECTION_POOL_IDLE_GAUGE] !== 'undefined' &&
|
|
117
|
+
typeof instruments[Gauge.CONNECTION_POOL_WAITING_GAUGE] !== 'undefined')
|
|
116
118
|
{
|
|
117
119
|
this.#observer = setInterval(() =>
|
|
118
120
|
{
|