@autofleet/nitur 1.2.5 → 1.3.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 +1 -1
- package/lib/alive-endpoint/index.d.ts +0 -6
- package/lib/alive-endpoint/index.js +0 -44
- package/lib/cloud-profiler/index.d.ts +0 -1
- package/lib/cloud-profiler/index.js +0 -16
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -31
- package/lib/logger.d.ts +0 -2
- package/lib/logger.js +0 -4
- package/lib/newrelic/index.d.ts +0 -2
- package/lib/newrelic/index.js +0 -19
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
16
|
-
exports.default = ({ rabbit = null, sequelize = null, redis = null, }) => (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
try {
|
|
18
|
-
if (rabbit) {
|
|
19
|
-
const isRabbitAlive = yield rabbit.isConnected();
|
|
20
|
-
if (!isRabbitAlive) {
|
|
21
|
-
throw new Error('Rabbit is not alive');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (sequelize) {
|
|
25
|
-
const [[{ status }]] = yield sequelize.query('select \'ok\' as status');
|
|
26
|
-
if (status !== 'ok') {
|
|
27
|
-
throw new Error('Sequelize is not alive');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (redis) {
|
|
31
|
-
yield redis.ping();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
res.status(500);
|
|
36
|
-
res.json({ err });
|
|
37
|
-
logger_1.default.error('Error on alive endpoint', { err });
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
res.json({
|
|
41
|
-
status: 'ok',
|
|
42
|
-
});
|
|
43
|
-
return true;
|
|
44
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const cloudProfilerReporter: (options?: any) => void;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cloudProfilerReporter = void 0;
|
|
4
|
-
const profiler_1 = require("@google-cloud/profiler");
|
|
5
|
-
const defaultOptions = {
|
|
6
|
-
service: `${process.env.ENV_NAME}.${process.env.AF_SERVICE_NAME}`,
|
|
7
|
-
version: process.env.VERSION,
|
|
8
|
-
};
|
|
9
|
-
exports.cloudProfilerReporter = (options) => {
|
|
10
|
-
profiler_1.start({
|
|
11
|
-
serviceContext: {
|
|
12
|
-
service: (options === null || options === void 0 ? void 0 : options.service) || defaultOptions.service,
|
|
13
|
-
version: (options === null || options === void 0 ? void 0 : options.version) || defaultOptions.version,
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
};
|
package/lib/index.d.ts
DELETED
package/lib/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.cloudProfiler = exports.aliveEndpoint = exports.newrelic = void 0;
|
|
26
|
-
const newrelic = __importStar(require("./newrelic"));
|
|
27
|
-
exports.newrelic = newrelic;
|
|
28
|
-
const alive_endpoint_1 = __importDefault(require("./alive-endpoint"));
|
|
29
|
-
exports.aliveEndpoint = alive_endpoint_1.default;
|
|
30
|
-
const cloudProfiler = __importStar(require("./cloud-profiler"));
|
|
31
|
-
exports.cloudProfiler = cloudProfiler;
|
package/lib/logger.d.ts
DELETED
package/lib/logger.js
DELETED
package/lib/newrelic/index.d.ts
DELETED
package/lib/newrelic/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.stopConnectionPoolReporter = exports.connectionPoolReporter = void 0;
|
|
7
|
-
const newrelic_1 = __importDefault(require("newrelic"));
|
|
8
|
-
exports.connectionPoolReporter = (sequelize, interval = 5000) => {
|
|
9
|
-
if (process.env.NEW_RELIC_KEY) {
|
|
10
|
-
const intervalId = setInterval(() => {
|
|
11
|
-
newrelic_1.default.recordMetric('SequelizePool/WaitingConnections', sequelize.connectionManager.pool.waiting);
|
|
12
|
-
newrelic_1.default.recordMetric('SequelizePool/UsingConnections', sequelize.connectionManager.pool.using);
|
|
13
|
-
newrelic_1.default.recordMetric('SequelizePool/AvailableConnections', sequelize.connectionManager.pool.available);
|
|
14
|
-
newrelic_1.default.recordMetric('SequelizePool/Utilization', sequelize.connectionManager.pool.using / sequelize.connectionManager.pool.available);
|
|
15
|
-
}, interval);
|
|
16
|
-
return intervalId;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
exports.stopConnectionPoolReporter = (intervalId) => clearInterval(intervalId);
|