@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.
Files changed (2) hide show
  1. package/package.json +4 -3
  2. package/pgpoolmanager.js +11 -9
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@nsshunt/stsdatamanagement",
3
- "version": "1.4.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.4.0",
8
- "@nsshunt/stsutils": "^1.5.5",
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.connectionPoolTotalCount !== 'undefined' &&
100
- typeof poolManager.instruments.connectionPoolIdleCount !== 'undefined' &&
101
- typeof poolManager.instruments.connectionPoolWaitingCount !== 'undefined')
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.connectionPoolTotalCount.Val = poolManager.pool.totalCount;
104
- poolManager.instruments.connectionPoolIdleCount.Val = poolManager.pool.idleCount;
105
- poolManager.instruments.connectionPoolWaitingCount.Val = poolManager.pool.waitingCount;
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.connectionPoolTotalCount !== 'undefined' &&
114
- typeof instruments.connectionPoolIdleCount !== 'undefined' &&
115
- typeof instruments.connectionPoolWaitingCount !== 'undefined')
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
  {