whatap 0.4.54 → 0.4.57

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.
@@ -218,6 +218,11 @@ var ConfigDefault = {
218
218
  "reqlog_x_dbc" : bool('reqlog_x_dbc', true),
219
219
  "reqlog_x_login" : bool('reqlog_x_login', true),
220
220
  "reqlog_x_rs" : bool('reqlog_x_rs', true),
221
+
222
+ // Cloud PLATFORM
223
+ "cloud_platform":str('cloud_platform', 'kic'),
224
+ "cloud_platform_chk":str('cloud_platform_chk', 'kr-central-1'),
225
+ "cloud_platform_httpc":str('cloud_platform_httpc', 'http://169.254.169.254/latest/meta-data/placement/availability-zone'),
221
226
  };
222
227
 
223
228
  ConfigDefault._hook_method_ignore_prefix = ConfigDefault.hook_method_ignore_prefixes.split(',');
package/lib/core/agent.js CHANGED
@@ -167,6 +167,8 @@ NodeAgent.prototype.initOK = function(cb) {
167
167
  param.putString('user.timezone', NodeUtil.getTimeZone());
168
168
  param.putString('user.home', os.homedir());
169
169
  param.putString('user.hostname', os.hostname());
170
+ // CLOUD PLATFORM INFO
171
+ param.putString('CLOUD_PLATFORM', WhatapUtil.cloudPlatformCheck());
170
172
  DataPackSender.sendBoot(param);
171
173
 
172
174
  if(self._counterManager === null) {
@@ -61,14 +61,16 @@ function sql_meter(p){
61
61
  for (var i = 0; i < 100 && en.hasMoreElements(); i++) {
62
62
  var key = en.nextElement();
63
63
  var b = MeterSql.stat.get(key);
64
- p.sql_meter.put(key, {
65
- time: b.sql_time,
66
- count: b.sql_count,
67
- error: b.sql_error,
68
- actx : 0,
69
- fetch_count: b.sql_fetch_count,
70
- fetch_time: b.sql_fetch_time
71
- });
64
+ if(b != null) {
65
+ p.sql_meter.put(key, {
66
+ time: b.time,
67
+ count: b.count,
68
+ error: b.error,
69
+ actx : 0,
70
+ fetch_count: b.fetch_count,
71
+ fetch_time: b.fetch_time
72
+ });
73
+ }
72
74
  }
73
75
  MeterSql.resetStat();
74
76
  }
package/lib/util/index.js CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
 
8
8
  var NodeUtil = require('../util/nodeutil');
9
+ var http = require('http');
9
10
  var Configure = require('../conf/configure'),
10
11
  Logger = require('../logger');
11
12
  var emptyIp = Buffer.alloc(4 , 0);
@@ -42,8 +43,36 @@ function printWhatap() {
42
43
  console.log(str);
43
44
  }
44
45
 
46
+ function cloudPlatformCheck() {
47
+ let cloud_platform = Configure.cloud_platform;
48
+ let cloud_platform_chk = Configure.cloud_platform_chk;
49
+ let cloud_platform_httpc = Configure.cloud_platform_httpc;
50
+ let CAP_INFO = '';
51
+ Logger.print('[cloudPlatformCheck]', `cloud_platform: ${cloud_platform} , cloud_platform_chk: ${cloud_platform_chk} , cloud_platform_httpc: ${cloud_platform_httpc}` , false)
52
+ http.get(cloud_platform_httpc, (resp) => {
53
+ let data = '';
54
+
55
+ resp.on('data', (chunk) => {
56
+ data += chunk;
57
+ });
58
+
59
+ resp.on('end', () => {
60
+ if (data.length < 5) return;
61
+ if (data.indexOf(cloud_platform_chk) >= 0) {
62
+ Logger.print('[cloudPlatformCheck]', "This agent is working in " + cloud_platform , false)
63
+ CAP_INFO = cloud_platform;
64
+ }
65
+ return CAP_INFO;
66
+ });
67
+ }).on("error", (err) => {
68
+ Logger.print('[cloudPlatformCheck Error]', "Error: " + err.message , false);
69
+ });
70
+ return CAP_INFO;
71
+ }
72
+
45
73
  module.exports = {
46
74
  getIPAddresses: getIPAddresses,
47
75
  getRandomInteger: getRandomInteger,
48
- printWhatap: printWhatap
49
- };
76
+ printWhatap: printWhatap,
77
+ cloudPlatformCheck:cloudPlatformCheck
78
+ };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "whatap",
3
3
  "homepage": "http://www.whatap.io",
4
- "version": "0.4.54",
5
- "releaseDate": "20220718",
4
+ "version": "0.4.57",
5
+ "releaseDate": "20220808",
6
6
  "description": "Monitoring and Profiling Service",
7
7
  "main": "index.js",
8
8
  "scripts": {},