@autofleet/nitur 1.3.2 → 1.3.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/lib/cloud-profiler/index.js +3 -2
- package/lib/index.js +6 -2
- package/lib/newrelic/index.js +8 -4
- package/package.json +8 -8
|
@@ -6,11 +6,12 @@ const defaultOptions = {
|
|
|
6
6
|
service: `${process.env.ENV_NAME}.${process.env.AF_SERVICE_NAME}`,
|
|
7
7
|
version: process.env.VERSION,
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
profiler_1.start({
|
|
9
|
+
const cloudProfilerReporter = (options) => {
|
|
10
|
+
(0, profiler_1.start)({
|
|
11
11
|
serviceContext: {
|
|
12
12
|
service: (options === null || options === void 0 ? void 0 : options.service) || defaultOptions.service,
|
|
13
13
|
version: (options === null || options === void 0 ? void 0 : options.version) || defaultOptions.version,
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
+
exports.cloudProfilerReporter = cloudProfilerReporter;
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
19
|
if (mod && mod.__esModule) return mod;
|
|
16
20
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
22
|
__setModuleDefault(result, mod);
|
|
19
23
|
return result;
|
|
20
24
|
};
|
package/lib/newrelic/index.js
CHANGED
|
@@ -11,7 +11,7 @@ if (!process.env.NEW_RELIC_KEY) {
|
|
|
11
11
|
const newrelic_1 = __importDefault(require("newrelic"));
|
|
12
12
|
const { memoryUsage } = process;
|
|
13
13
|
const parseBytes = bytes => bytes / 1024 / 1024;
|
|
14
|
-
|
|
14
|
+
const connectionPoolReporter = (sequelize, interval = 5000) => {
|
|
15
15
|
if (process.env.NEW_RELIC_KEY) {
|
|
16
16
|
const intervalId = setInterval(() => {
|
|
17
17
|
newrelic_1.default.recordMetric('SequelizePool/WaitingConnections', sequelize.connectionManager.pool.waiting);
|
|
@@ -22,8 +22,10 @@ exports.connectionPoolReporter = (sequelize, interval = 5000) => {
|
|
|
22
22
|
return intervalId;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
exports.
|
|
26
|
-
|
|
25
|
+
exports.connectionPoolReporter = connectionPoolReporter;
|
|
26
|
+
const stopConnectionPoolReporter = (intervalId) => clearInterval(intervalId);
|
|
27
|
+
exports.stopConnectionPoolReporter = stopConnectionPoolReporter;
|
|
28
|
+
const nonHeapMemoryReporter = (interval = 5000) => {
|
|
27
29
|
if (process.env.NEW_RELIC_KEY) {
|
|
28
30
|
const intervalId = setInterval(() => {
|
|
29
31
|
const { rss, heapUsed, arrayBuffers, external, } = memoryUsage();
|
|
@@ -35,4 +37,6 @@ exports.nonHeapMemoryReporter = (interval = 5000) => {
|
|
|
35
37
|
return intervalId;
|
|
36
38
|
}
|
|
37
39
|
};
|
|
38
|
-
exports.
|
|
40
|
+
exports.nonHeapMemoryReporter = nonHeapMemoryReporter;
|
|
41
|
+
const stopNonHeapMemoryReporter = (intervalId) => clearInterval(intervalId);
|
|
42
|
+
exports.stopNonHeapMemoryReporter = stopNonHeapMemoryReporter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autofleet/nitur",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "A package for service monitoring",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/Autofleet/nitur/issues"
|
|
22
22
|
},
|
|
23
|
-
"peerDependencies": {
|
|
24
|
-
"newrelic": ">=4.10.0"
|
|
25
|
-
},
|
|
26
23
|
"devDependencies": {
|
|
27
24
|
"@types/node": "^14.14.20",
|
|
28
|
-
"typescript": "^
|
|
25
|
+
"typescript": "^5.5.2"
|
|
29
26
|
},
|
|
30
27
|
"homepage": "https://github.com/Autofleet/nitur#readme",
|
|
31
28
|
"files": [
|
|
32
29
|
"lib/**/*"
|
|
33
30
|
],
|
|
34
31
|
"dependencies": {
|
|
35
|
-
"@autofleet/logger": "^
|
|
36
|
-
"@google-cloud/profiler": "^
|
|
37
|
-
"newrelic": "^
|
|
32
|
+
"@autofleet/logger": "^3.0.0",
|
|
33
|
+
"@google-cloud/profiler": "^6.0.1",
|
|
34
|
+
"newrelic": "^11.1.0"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=14.0.0"
|
|
38
38
|
}
|
|
39
39
|
}
|