whatap 0.4.55 → 0.4.58

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.
@@ -194,7 +194,7 @@ var ConfigDefault = {
194
194
  // reqlog add
195
195
  "reqlog_rotation_enabled": true,
196
196
  "reqlog_keep_days": 7,
197
- "reqlog_enabled": false,
197
+ "reqlog_enabled": bool('reqlog_enabled', false),
198
198
  "reqlog_seperator" : str('reqlog_seperator', '|'),
199
199
 
200
200
  "reqlog_x_etime" : bool('reqlog_x_etime', true),
@@ -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
@@ -123,8 +123,8 @@ NodeAgent.prototype.init = function(cb) {
123
123
  e, true);
124
124
  return;
125
125
  }
126
- Logger.print('WHATAP-101', 'Finish initialize configuration...', false);
127
- if(self._conf['reqlog_enabled'] === true ) {
126
+ Logger.print('WHATAP-101', 'Finish initialize configuration... ' + Boolean(self._conf['reqlog_enabled']) , false);
127
+ if(Boolean(self._conf['reqlog_enabled']) == true ) {
128
128
  Logger.print("WHATAP-REQLOG" , "ReqLog Init Start !!!! " , false);
129
129
  RequestLog.initializer.process();
130
130
  }
@@ -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.time,
66
- count: b.count,
67
- error: b.error,
68
- actx : 0,
69
- fetch_count: b.fetch_count,
70
- fetch_time: b.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
  }
@@ -402,7 +402,7 @@ HttpObserver.prototype.__endTransaction = function(error, ctx, req, res) {
402
402
 
403
403
  profile.oid = SecurityMaster.OID;
404
404
  profile.service = wtx;
405
- if(conf.reqlog_enabled === true) {
405
+ if(Boolean(conf.reqlog_enabled) == true) {
406
406
  ctx.endTime = wtx.endTime;
407
407
  ctx.elapsed = wtx.elapsed;
408
408
  RequestLog.setRecord(ctx);
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.55",
5
- "releaseDate": "20220718",
4
+ "version": "0.4.58",
5
+ "releaseDate": "20220819",
6
6
  "description": "Monitoring and Profiling Service",
7
7
  "main": "index.js",
8
8
  "scripts": {},