@autofleet/nitur 1.1.3 → 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.
@@ -1,6 +1,6 @@
1
1
  declare const _default: ({ rabbit, sequelize, redis, }: {
2
- rabbit: any;
3
- sequelize: any;
4
- redis: any;
2
+ rabbit?: any;
3
+ sequelize?: any;
4
+ redis?: any;
5
5
  }) => (req: any, res: any) => Promise<boolean>;
6
6
  export default _default;
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const logger_1 = __importDefault(require("../logger"));
16
- exports.default = ({ rabbit, sequelize, redis, }) => (req, res) => __awaiter(void 0, void 0, void 0, function* () {
16
+ exports.default = ({ rabbit = null, sequelize = null, redis = null, }) => (req, res) => __awaiter(void 0, void 0, void 0, function* () {
17
17
  try {
18
18
  if (rabbit) {
19
19
  const isRabbitAlive = yield rabbit.isConnected();
@@ -0,0 +1 @@
1
+ export declare const cloudProfilerReporter: (options: any) => void;
@@ -0,0 +1,19 @@
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.cloudProfilerReporter = void 0;
7
+ const profiler_1 = __importDefault(require("@google-cloud/profiler"));
8
+ const defaultOptions = {
9
+ service: process.env.AF_SERVICE_NAME,
10
+ version: process.env.VERSION,
11
+ };
12
+ exports.cloudProfilerReporter = (options) => {
13
+ profiler_1.default.start({
14
+ serviceContext: {
15
+ service: (options === null || options === void 0 ? void 0 : options.service) || defaultOptions.service,
16
+ version: (options === null || options === void 0 ? void 0 : options.version) || defaultOptions.version,
17
+ }
18
+ });
19
+ };
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import * as newrelic from './newrelic';
2
2
  import aliveEndpoint from './alive-endpoint';
3
- export { newrelic, aliveEndpoint };
3
+ import * as cloudProfiler from './cloud-profiler';
4
+ export { newrelic, aliveEndpoint, cloudProfiler, };
package/lib/index.js CHANGED
@@ -22,8 +22,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.aliveEndpoint = exports.newrelic = void 0;
25
+ exports.cloudProfiler = exports.aliveEndpoint = exports.newrelic = void 0;
26
26
  const newrelic = __importStar(require("./newrelic"));
27
27
  exports.newrelic = newrelic;
28
28
  const alive_endpoint_1 = __importDefault(require("./alive-endpoint"));
29
29
  exports.aliveEndpoint = alive_endpoint_1.default;
30
+ const cloudProfiler = __importStar(require("./cloud-profiler"));
31
+ exports.cloudProfiler = cloudProfiler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/nitur",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "A package for service monitoring",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -33,6 +33,7 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@autofleet/logger": "^1.2.8",
36
- "newrelic": "^8.6.0"
36
+ "@google-cloud/profiler": "^4.1.7",
37
+ "newrelic": "^4.10.0"
37
38
  }
38
39
  }