whatap 0.4.88 → 0.4.89
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.
|
@@ -20,69 +20,43 @@ var loadedPackageList = [],
|
|
|
20
20
|
dependencies = [];
|
|
21
21
|
|
|
22
22
|
var PackageCtrHelper = function() {};
|
|
23
|
-
PackageCtrHelper.addPackage = function(
|
|
23
|
+
PackageCtrHelper.addPackage = function(realPath){
|
|
24
24
|
try {
|
|
25
|
-
if
|
|
26
|
-
|
|
27
|
-
loadedPackageList.push(name);
|
|
28
|
-
}
|
|
29
|
-
} else if(callPath != null) {
|
|
30
|
-
var callerPath = path.join(callPath, '..');
|
|
31
|
-
var filename = name;
|
|
32
|
-
var realPath = callerPath;
|
|
33
|
-
try {
|
|
34
|
-
realPath = fs.realpathSync(path.join(callerPath, filename));
|
|
35
|
-
} catch(e) {
|
|
36
|
-
try {
|
|
37
|
-
filename += '.js';
|
|
38
|
-
realPath = fs.realpathSync(path.join(callerPath, filename));
|
|
39
|
-
} catch(e) {
|
|
40
|
-
return Logger.printError("WHATAP-511", "PackageControler helper", e, false);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
loadedPackages[realPath] = pkg;
|
|
25
|
+
if(!loadedPackages[realPath]){
|
|
26
|
+
loadedPackages[realPath] = require(realPath);
|
|
44
27
|
}
|
|
45
28
|
} catch(e) {
|
|
46
29
|
return Logger.printError("WHATAP-512", "PackageControler helper", e, false);
|
|
47
30
|
}
|
|
48
31
|
};
|
|
49
|
-
PackageCtrHelper.dynamicHook = function(realPath, funcName) {
|
|
50
|
-
if(
|
|
32
|
+
PackageCtrHelper.dynamicHook = function(pkg, realPath, funcName) {
|
|
33
|
+
if(!pkg || !funcName) {
|
|
51
34
|
return;
|
|
52
35
|
}
|
|
53
|
-
if(loadedPackages[realPath]){
|
|
54
|
-
var pkg = loadedPackages[realPath];
|
|
55
36
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
_aop.before(pkg, functName, function(){
|
|
82
|
-
// transaction step
|
|
83
|
-
}, false);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
37
|
+
var Interceptor = require('../core/interceptor').Interceptor;
|
|
38
|
+
var _aop = new Interceptor(null);
|
|
39
|
+
_aop.both(pkg, funcName,
|
|
40
|
+
function(obj, args, lctx){
|
|
41
|
+
// transaction step
|
|
42
|
+
var ctx = lctx.context;
|
|
43
|
+
if(!ctx) { return; }
|
|
44
|
+
|
|
45
|
+
var msg = realPath + ' ' + funcName;
|
|
46
|
+
var hash = HashUtil.hashFromString(msg);
|
|
47
|
+
var step = new MethodStep();
|
|
48
|
+
DataTextAgent.METHOD.add(hash, msg);
|
|
49
|
+
step.hash = hash;
|
|
50
|
+
step.start_time = ctx.getElapsedTime();
|
|
51
|
+
pkg.__whatap_step__ = step;
|
|
52
|
+
},
|
|
53
|
+
function(obj, args, ret, lctx){
|
|
54
|
+
var ctx = lctx.context;
|
|
55
|
+
if(!ctx) { return; }
|
|
56
|
+
var step = pkg.__whatap_step__;
|
|
57
|
+
step.elapsed = ctx.getElapsedTime() - step.start_time;
|
|
58
|
+
ctx.profile.add(step);
|
|
59
|
+
});
|
|
86
60
|
};
|
|
87
61
|
PackageCtrHelper.getLoadedPackageList = function(filter){
|
|
88
62
|
return loadedPackageList;
|
|
@@ -142,9 +116,11 @@ conf.on('hook_method_patterns', function (value) {
|
|
|
142
116
|
root = root.substr(0, root.indexOf('/bin'));
|
|
143
117
|
}
|
|
144
118
|
var real_path = root + relative_path;
|
|
145
|
-
PackageCtrHelper.
|
|
119
|
+
PackageCtrHelper.addPackage(real_path);
|
|
120
|
+
if(loadedPackages[real_path]) {
|
|
121
|
+
PackageCtrHelper.dynamicHook(loadedPackages[real_path], real_path, method);
|
|
122
|
+
}
|
|
146
123
|
});
|
|
147
|
-
|
|
148
124
|
});
|
|
149
125
|
|
|
150
126
|
module.exports = PackageCtrHelper;
|
|
@@ -70,7 +70,7 @@ var SecurityMaster = {
|
|
|
70
70
|
OidUtil.setType(process.env.name || Configuration.getProperty("whatap.type", "NODE"));
|
|
71
71
|
|
|
72
72
|
var name_pattern;
|
|
73
|
-
if(Configuration.getProperty('whatap_micro_enabled') === true){
|
|
73
|
+
if(Configuration.getProperty('whatap_micro_enabled', false) === true){
|
|
74
74
|
name_pattern = process.env.WHATAP_NAME || "{okind}-{ip2}-{ip3}";
|
|
75
75
|
}else if(require('cluster').isMaster){
|
|
76
76
|
name_pattern=process.env.WHATAP_NAME || "{type}-{ip2}-{ip3}";
|
|
@@ -90,8 +90,9 @@ var SecurityMaster = {
|
|
|
90
90
|
this.OKIND_NAME=null;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
if(Configuration.getProperty('whatap_micro_enabled') === false) {
|
|
93
|
+
if(Configuration.getProperty('whatap_micro_enabled', false) === false) {
|
|
94
94
|
var onodeStr= process.env.WHATAP_ONODE || Configuration.getProperty('whatap.onode');
|
|
95
|
+
console.log(onodeStr)
|
|
95
96
|
if(onodeStr && onodeStr.length>0){
|
|
96
97
|
this.ONODE = HashUtil.hashFromString(onodeStr);
|
|
97
98
|
this.ONODE_NAME=onodeStr;
|
|
@@ -107,7 +108,7 @@ var SecurityMaster = {
|
|
|
107
108
|
|
|
108
109
|
if (lastOid != this.OID) {
|
|
109
110
|
lastOid = this.OID;
|
|
110
|
-
|
|
111
|
+
require('../logger').print('WHATAP-968', "OID: " + this.OID + " ONAME: " + this.ONAME + " IP: " + IPUtil.intToString(this.IP), false);
|
|
111
112
|
}
|
|
112
113
|
},
|
|
113
114
|
setAgentOnameOid :function (oname, myIp) {
|
|
@@ -139,7 +140,7 @@ var SecurityMaster = {
|
|
|
139
140
|
this.OKIND_NAME=null;
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
if(Configuration.getProperty('whatap_micro_enabled') === false) {
|
|
143
|
+
if(Configuration.getProperty('whatap_micro_enabled', false) === false) {
|
|
143
144
|
var onodeStr= process.env.WHATAP_ONODE || Configuration.getProperty('whatap.onode');
|
|
144
145
|
if(onodeStr && onodeStr.length>0){
|
|
145
146
|
this.ONODE = HashUtil.hashFromString(onodeStr);
|
|
@@ -149,7 +150,7 @@ var SecurityMaster = {
|
|
|
149
150
|
this.ONODE_NAME=null;
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
+
|
|
153
154
|
if (lastOid != this.OID) {
|
|
154
155
|
lastOid = this.OID;
|
|
155
156
|
require('../logger').print('WHATAP-168', "OID: " + this.OID + " ONAME: " + this.ONAME + " IP: " + IPUtil.intToString(this.IP), false);
|
|
@@ -169,14 +170,14 @@ var SecurityMaster = {
|
|
|
169
170
|
ProcessSeq('whatap').accessAuth(function(pseq){
|
|
170
171
|
if(!pseq){
|
|
171
172
|
return;
|
|
172
|
-
}
|
|
173
|
+
}
|
|
173
174
|
var conf = require('./../conf/configure');
|
|
174
175
|
conf.setProperty('node.clusterId', pseq);
|
|
175
176
|
if(cb) cb();
|
|
176
177
|
});
|
|
177
178
|
*/
|
|
178
179
|
}
|
|
179
|
-
|
|
180
|
+
|
|
180
181
|
}
|
|
181
182
|
};
|
|
182
183
|
|
package/lib/step/method-stepx.js
CHANGED
|
@@ -29,7 +29,6 @@ MethodStepX.prototype.write = function(dout) {
|
|
|
29
29
|
dout.writeByte(0);
|
|
30
30
|
dout.writeDecimal(this.hash);
|
|
31
31
|
dout.writeDecimal(this.elapsed);
|
|
32
|
-
dout.writeByte(this.opt);
|
|
33
32
|
dout.writeDecimal(this.start_cpu);
|
|
34
33
|
dout.writeDecimal(this.start_mem);
|
|
35
34
|
dout.writeIntArray(this.stack);
|
|
@@ -39,7 +38,6 @@ MethodStepX.prototype.read = function(din) {
|
|
|
39
38
|
var ver = din.readByte();
|
|
40
39
|
this.hash = din.readDecNumber();
|
|
41
40
|
this.elapsed = din.readDecNumber();
|
|
42
|
-
this.opt = din.readByte();
|
|
43
41
|
this.start_cpu = din.readDecNumber();
|
|
44
42
|
this.start_mem = din.readDecNumber();
|
|
45
43
|
this.stack = din.readIntArray();
|
package/package.json
CHANGED
package/logs/whatap-20231212.log
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
20231212 15:46:55[WHATAP-001] <80146> Start initialize WhaTap Agent... Root[/Users/seunghunlee/workspace/nodejs_agent]
|
|
2
|
-
20231212 15:46:55[WHATAP-INIT] <80146> HttpObserver starting!
|
|
3
|
-
20231212 15:46:55[WHATAP-INIT] <80146> HttpObserver starting!
|
|
4
|
-
20231212 15:46:55[WHATAP-INIT] <80146> NetObserver starting!
|
|
5
|
-
20231212 15:46:55[WHTAP-loadObserves] <80146> unable to load mysql module
|
|
6
|
-
20231212 15:46:55[WHATAP-INIT] <80146> FileObserve starting!
|
|
7
|
-
20231212 15:46:55[WHATAP-203] <80146> Config file reloaded
|
|
8
|
-
20231212 15:46:55[WHATAP-101] <80146> Finish initialize configuration... false
|
|
9
|
-
20231212 15:46:55[WHATAP-110] <80146> [pcode=0,SECURE_KEY=]
|
|
10
|
-
20231212 15:46:55[WHATAP-170] <80146> [WhaTap Agent] now waiting for starting......
|