@autofleet/node-common 1.1.22 → 1.1.23

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/index.js CHANGED
@@ -4,6 +4,8 @@ const Settings = require('./settings');
4
4
  const client = require('./delorean-client');
5
5
  const Router = require('./router');
6
6
 
7
+ require('./monitor');
8
+
7
9
  module.exports = {
8
10
  Network,
9
11
  Logger,
package/logger/index.js CHANGED
@@ -1,7 +1,9 @@
1
+ require('dotenv').config();
1
2
  const winston = require('winston');
3
+ const { LoggingWinston } = require('@google-cloud/logging-winston');
2
4
 
3
5
  const { createLogger } = winston;
4
- require('dotenv').config();
6
+ const loggingWinston = new LoggingWinston();
5
7
 
6
8
  const { env } = process;
7
9
 
@@ -35,7 +37,10 @@ const createLoggerInstance = (level, transports) => {
35
37
  const logger = createLogger({
36
38
  level,
37
39
  format: getFormat(),
38
- transports: [new winston.transports.Console()],
40
+ transports: [
41
+ new winston.transports.Console(),
42
+ loggingWinston,
43
+ ],
39
44
  exceptionHandlers: transports,
40
45
  exitOnError: false,
41
46
  });
@@ -0,0 +1,16 @@
1
+ const monitoring = require('@google-cloud/monitoring');
2
+ const profiler = require('@google-cloud/profiler');
3
+
4
+ const projectId = process.env.PROJECT_ID;
5
+ const afServiceName = process.env.AF_SERVICE_NAME;
6
+
7
+ if (projectId) {
8
+ const client = new monitoring.MetricServiceClient(); // eslint-disable-line
9
+
10
+ profiler.start({
11
+ serviceContext: {
12
+ service: afServiceName,
13
+ version: '1.0.0',
14
+ },
15
+ });
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/node-common",
3
- "version": "1.1.22",
3
+ "version": "1.1.23",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "coverage": "jest --coverage --forceExit --runInBand",
@@ -22,12 +22,15 @@
22
22
  },
23
23
  "homepage": "https://gitlab.com/AutoFleet/node-common#README",
24
24
  "dependencies": {
25
+ "@google-cloud/logging-winston": "^0.9.0",
26
+ "@google-cloud/monitoring": "^0.6.0",
27
+ "@google-cloud/profiler": "^0.2.0",
25
28
  "@google-cloud/pubsub": "^0.19.0",
26
29
  "axios": "^0.18.0",
27
- "express": "^4.16.2",
28
30
  "axios-retry": "^3.1.0",
29
31
  "dotenv": "^5.0.1",
30
32
  "event-pubsub": "^4.3.0",
33
+ "express": "^4.16.2",
31
34
  "jest": "^22.4.3",
32
35
  "mock-socket": "^7.1.0",
33
36
  "node-cache": "^4.2.0",