whatap 1.0.1 → 1.0.2
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/README.md +32 -78
- package/lib/conf/conf-sys-mon.js +101 -0
- package/lib/conf/config-default.js +10 -3
- package/lib/conf/configure.js +369 -349
- package/lib/conf/license.js +1 -1
- package/lib/control/cmd-config.js +24 -0
- package/lib/control/control-handler.js +367 -0
- package/lib/control/packagectr-helper.js +34 -3
- package/lib/core/agent.js +176 -882
- package/lib/core/interceptor.js +6 -6
- package/lib/core/request-agent.js +27 -0
- package/lib/core/shimmer.js +82 -36
- package/lib/counter/counter-manager.js +79 -8
- package/lib/counter/meter/meter-activex.js +67 -0
- package/lib/counter/meter/meter-httpc.js +57 -0
- package/lib/counter/meter/meter-resource.js +9 -0
- package/lib/counter/meter/meter-service.js +168 -0
- package/lib/counter/meter/meter-socket.io.js +51 -0
- package/lib/counter/meter/meter-sql.js +71 -0
- package/lib/counter/meter/meter-users.js +58 -0
- package/lib/counter/meter.js +183 -0
- package/lib/counter/task/activetransaction.js +68 -17
- package/lib/counter/task/agentinfo.js +107 -0
- package/lib/{system → counter/task}/gc-action.js +27 -74
- package/lib/counter/task/gcstat.js +34 -0
- package/lib/counter/task/heapmem.js +25 -0
- package/lib/counter/task/httpc.js +76 -0
- package/lib/counter/task/metering-info.js +125 -0
- package/lib/counter/task/proc-cpu.js +29 -0
- package/lib/counter/task/realtimeuser.js +31 -0
- package/lib/counter/task/res/systemECSTask.js +39 -0
- package/lib/counter/task/res/systemKubeTask.js +53 -0
- package/lib/counter/task/res/util/awsEcsClientThread.js +218 -0
- package/lib/counter/task/res/util/linuxProcStatUtil.js +14 -0
- package/lib/counter/task/res-sys-cpu.js +62 -0
- package/lib/counter/task/service.js +202 -0
- package/lib/counter/task/socketio.js +30 -0
- package/lib/counter/task/sql.js +105 -0
- package/lib/counter/task/systemperf.js +43 -0
- package/lib/data/datapack-sender.js +289 -0
- package/lib/data/dataprofile-agent.js +162 -0
- package/lib/data/datatext-agent.js +135 -0
- package/lib/data/event-level.js +15 -0
- package/lib/data/test.js +49 -0
- package/lib/data/zipprofile.js +197 -0
- package/lib/env/constants.js +21 -0
- package/lib/error/error-handler.js +437 -0
- package/lib/io/data-inputx.js +13 -3
- package/lib/io/data-outputx.js +268 -206
- package/lib/kube/kube-client.js +144 -0
- package/lib/lang/text-types.js +58 -0
- package/lib/logger.js +6 -6
- package/lib/logsink/line-log-util.js +87 -0
- package/lib/logsink/line-log.js +12 -0
- package/lib/logsink/log-sender.js +78 -0
- package/lib/logsink/log-tracer.js +40 -0
- package/lib/logsink/sender-util.js +56 -0
- package/lib/logsink/zip/zip-send.js +177 -0
- package/lib/net/netflag.js +55 -0
- package/lib/net/receiver.js +66 -0
- package/lib/net/security-master.js +139 -20
- package/lib/net/sender.js +141 -0
- package/lib/net/tcp-return.js +18 -0
- package/lib/net/tcp-session.js +286 -0
- package/lib/net/tcpreq-client-proxy.js +70 -0
- package/lib/net/tcprequest-mgr.js +58 -0
- package/lib/observers/apollo-server-observer.js +33 -27
- package/lib/observers/cluster-observer.js +22 -0
- package/lib/observers/express-observer.js +215 -0
- package/lib/observers/file-observer.js +184 -0
- package/lib/observers/global-observer.js +155 -80
- package/lib/observers/grpc-observer.js +336 -0
- package/lib/observers/http-observer.js +666 -236
- package/lib/observers/maria-observer.js +204 -362
- package/lib/observers/memcached-observer.js +56 -0
- package/lib/observers/mongo-observer.js +317 -0
- package/lib/observers/mongodb-observer.js +169 -226
- package/lib/observers/mongoose-observer.js +518 -323
- package/lib/observers/mssql-observer.js +177 -418
- package/lib/observers/mysql-observer.js +342 -449
- package/lib/observers/mysql2-observer.js +396 -358
- package/lib/observers/net-observer.js +77 -0
- package/lib/observers/oracle-observer.js +559 -384
- package/lib/observers/pgsql-observer.js +231 -489
- package/lib/observers/prisma-observer.js +303 -92
- package/lib/observers/process-observer.js +79 -35
- package/lib/observers/promise-observer.js +31 -0
- package/lib/observers/redis-observer.js +166 -331
- package/lib/observers/schedule-observer.js +67 -0
- package/lib/observers/socket.io-observer.js +226 -187
- package/lib/observers/stream-observer.js +19 -0
- package/lib/observers/thrift-observer.js +197 -0
- package/lib/observers/websocket-observer.js +175 -301
- package/lib/pack/activestack-pack.js +55 -0
- package/lib/pack/apenum.js +8 -0
- package/lib/pack/counter-pack.js +3 -0
- package/lib/pack/errorsnap-pack.js +69 -0
- package/lib/pack/event-pack.js +54 -0
- package/lib/pack/hitmap-pack.js +63 -0
- package/lib/pack/hitmap-pack1.js +152 -0
- package/lib/pack/log-sink-pack.js +14 -52
- package/lib/pack/netstat.js +15 -0
- package/lib/pack/otype.js +7 -0
- package/lib/pack/profile-pack.js +49 -0
- package/lib/pack/realtimeuser-pack.js +41 -0
- package/lib/pack/stat-general-pack.js +96 -0
- package/lib/pack/staterror-pack.js +120 -0
- package/lib/pack/stathttpc-pack.js +66 -0
- package/lib/pack/stathttpc-rec.js +78 -0
- package/lib/pack/statremote-pack.js +46 -0
- package/lib/pack/statservice-pack.js +63 -0
- package/lib/pack/statservice-pack1.js +88 -0
- package/lib/pack/statservice-rec.js +292 -0
- package/lib/pack/statservice-rec_dep.js +151 -0
- package/lib/pack/statsql-pack.js +69 -0
- package/lib/pack/statsql-rec.js +100 -0
- package/lib/pack/statuseragent-pack.js +44 -0
- package/lib/pack/tagcount-pack.js +4 -4
- package/lib/pack/tagctr.js +15 -0
- package/lib/pack/text-pack.js +50 -0
- package/lib/pack/time-count.js +25 -0
- package/lib/pack/websocket.js +15 -0
- package/lib/pack/zip-pack.js +70 -0
- package/lib/pii/pii-item.js +31 -0
- package/lib/pii/pii-mask.js +174 -0
- package/lib/plugin/plugin-loadermanager.js +57 -0
- package/lib/plugin/plugin.js +75 -0
- package/lib/service/tx-record.js +332 -0
- package/lib/stat/stat-error.js +116 -0
- package/lib/stat/stat-httpc.js +98 -0
- package/lib/stat/stat-remote-ip.js +46 -0
- package/lib/stat/stat-remote-ipurl.js +88 -0
- package/lib/stat/stat-sql.js +113 -0
- package/lib/stat/stat-tranx.js +58 -0
- package/lib/stat/stat-tx-caller.js +160 -0
- package/lib/stat/stat-tx-domain.js +111 -0
- package/lib/stat/stat-tx-referer.js +112 -0
- package/lib/stat/stat-useragent.js +48 -0
- package/lib/stat/timingsender.js +76 -0
- package/lib/step/activestack-step.js +38 -0
- package/lib/step/dbc-step.js +36 -0
- package/lib/step/http-stepx.js +67 -0
- package/lib/step/message-step.js +40 -0
- package/lib/step/method-stepx.js +45 -0
- package/lib/step/resultset-step.js +40 -0
- package/lib/step/securemsg-step.js +44 -0
- package/lib/step/socket-step.js +46 -0
- package/lib/step/sql-stepx.js +68 -0
- package/lib/step/sqlxtype.js +16 -0
- package/lib/step/step.js +66 -0
- package/lib/step/stepenum.js +54 -0
- package/lib/topology/link.js +63 -0
- package/lib/topology/nodeinfo.js +123 -0
- package/lib/topology/status-detector.js +111 -0
- package/lib/trace/trace-context-manager.js +113 -25
- package/lib/trace/trace-context.js +21 -7
- package/lib/trace/trace-httpc.js +17 -11
- package/lib/trace/trace-sql.js +29 -21
- package/lib/util/anylist.js +103 -0
- package/lib/util/cardinality/hyperloglog.js +106 -0
- package/lib/util/cardinality/murmurhash.js +31 -0
- package/lib/util/cardinality/registerset.js +75 -0
- package/lib/util/errordata.js +21 -0
- package/lib/util/escape-literal-sql.js +5 -5
- package/lib/util/hashutil.js +18 -18
- package/lib/util/iputil_x.js +527 -0
- package/lib/util/keygen.js +0 -3
- package/lib/util/kube-util.js +73 -0
- package/lib/util/linkedset.js +1 -2
- package/lib/util/nodeutil.js +2 -1
- package/lib/util/paramsecurity.js +80 -0
- package/lib/util/pre-process.js +13 -0
- package/lib/util/process-seq.js +166 -0
- package/lib/util/property-util.js +36 -0
- package/lib/util/request-queue.js +70 -0
- package/lib/util/requestdouble-queue.js +72 -0
- package/lib/util/resourceprofile.js +157 -0
- package/lib/util/stop-watch.js +30 -0
- package/lib/util/system-util.js +10 -0
- package/lib/util/userid-util.js +57 -0
- package/lib/value/map-value.js +3 -2
- package/package.json +9 -4
- package/whatap.conf +1 -4
- package/agent/darwin/arm64/whatap_nodejs +0 -0
- package/agent/linux/amd64/whatap_nodejs +0 -0
- package/agent/linux/arm64/whatap_nodejs +0 -0
- package/build.txt +0 -4
- package/lib/observers/ioredis-observer.js +0 -294
- package/lib/udp/async_sender.js +0 -119
- package/lib/udp/index.js +0 -17
- package/lib/udp/packet_enum.js +0 -52
- package/lib/udp/packet_queue.js +0 -69
- package/lib/udp/packet_type_enum.js +0 -33
- package/lib/udp/param_def.js +0 -72
- package/lib/udp/udp_session.js +0 -336
- package/lib/util/sql-util.js +0 -178
- package/lib/util/trace-helper.js +0 -91
- package/lib/util/transfer.js +0 -58
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2016 the WHATAP project authors. All rights reserved.
|
|
3
|
+
* Use of this source code is governed by a license that
|
|
4
|
+
* can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var TraceContextManager = require('../trace/trace-context-manager'),
|
|
8
|
+
MethodStepX = require('../step/method-stepx'),
|
|
9
|
+
DBCStep = require('../step/dbc-step'),
|
|
10
|
+
ResultSetStep = require('../step/resultset-step'),
|
|
11
|
+
DataTextAgent = require('../data/datatext-agent'),
|
|
12
|
+
StatSql = require('../stat/stat-sql'),
|
|
13
|
+
MeterSql = require('../counter/meter/meter-sql'),
|
|
14
|
+
conf = require('../conf/configure'),
|
|
15
|
+
IntKeyMap = require('../util/intkey-map'),
|
|
16
|
+
EscapeLiteralSQL = require('../util/escape-literal-sql'),
|
|
17
|
+
HashUtil = require('../util/hashutil'),
|
|
18
|
+
StatError = require('../stat/stat-error'),
|
|
19
|
+
TextTypes = require('../lang/text-types'),
|
|
20
|
+
ParamSecurity = require('../util/paramsecurity'),
|
|
21
|
+
Logger = require('../logger'),
|
|
22
|
+
Buffer = require('buffer').Buffer;
|
|
23
|
+
|
|
24
|
+
var ThriftObserver = function (agent) {
|
|
25
|
+
this.agent = agent;
|
|
26
|
+
this.packages = ['thrift'];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
ThriftObserver.prototype.inject = function (mod, moduleName) {
|
|
31
|
+
if (mod.__whatap_observe__) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
mod.__whatap_observe__ = true;
|
|
35
|
+
Logger.initPrint("ThriftObserver");
|
|
36
|
+
var self = this;
|
|
37
|
+
var aop = self.agent.aop;
|
|
38
|
+
|
|
39
|
+
if (conf.trx_profile_thrift_enabled == false) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
aop.both(mod, 'createConnection',
|
|
44
|
+
createConnectionBeforeHook,
|
|
45
|
+
createConnectionAfterHook);
|
|
46
|
+
|
|
47
|
+
aop.both(mod, 'createSSLConnection',
|
|
48
|
+
createConnectionBeforeHook,
|
|
49
|
+
createConnectionAfterHook);
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
function createConnectionBeforeHook(obj, args, lctx) {
|
|
53
|
+
var ctx = lctx.context;
|
|
54
|
+
if(ctx == null || ctx.db_opening) { return; }
|
|
55
|
+
|
|
56
|
+
ctx.thrift_opeing = true;
|
|
57
|
+
|
|
58
|
+
var dbc_step = new DBCStep();
|
|
59
|
+
dbc_step.start_time = ctx.getElapsedTime();
|
|
60
|
+
lctx.step = dbc_step;
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
function createConnectionAfterHook(obj, args, ret, lctx){
|
|
66
|
+
|
|
67
|
+
var dbc, dbc_hash;
|
|
68
|
+
if(args.length > 1) {
|
|
69
|
+
var host = args[0];
|
|
70
|
+
var port = args[1];
|
|
71
|
+
//Open [DatabaseName] connection 메세지 보여줄때 필요함.
|
|
72
|
+
dbc = 'thrift://';
|
|
73
|
+
dbc += host || '';
|
|
74
|
+
dbc += ':';
|
|
75
|
+
dbc += port || '';
|
|
76
|
+
dbc_hash = HashUtil.hashFromString(dbc);
|
|
77
|
+
DataTextAgent.DBC.add(dbc_hash, dbc);
|
|
78
|
+
DataTextAgent.METHOD.add(dbc_hash, dbc);
|
|
79
|
+
DataTextAgent.ERROR.add(dbc_hash, dbc);
|
|
80
|
+
|
|
81
|
+
ret.dbc_hash = dbc_hash;
|
|
82
|
+
ret.dbc_string = dbc;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var ctx = lctx.context,
|
|
86
|
+
step = lctx.step;
|
|
87
|
+
|
|
88
|
+
// secureConnect, connect, error, close, timeout
|
|
89
|
+
|
|
90
|
+
if (ctx == null || step == null) { return; }
|
|
91
|
+
|
|
92
|
+
TraceContextManager.resume(ctx);
|
|
93
|
+
step.hash = dbc_hash;
|
|
94
|
+
|
|
95
|
+
ret.on('connect', connectComplete);
|
|
96
|
+
ret.on('secureConnect', connectComplete);
|
|
97
|
+
|
|
98
|
+
function connectComplete(obj, args){
|
|
99
|
+
// var ctx = TraceContextManager.getCurrentContext();
|
|
100
|
+
// var step = ctx.step;
|
|
101
|
+
|
|
102
|
+
if (ctx == null || step == null) { return; }
|
|
103
|
+
|
|
104
|
+
ctx.profile.push(step);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
aop.before(ret, 'error', function (obj, args) {
|
|
108
|
+
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
aop.both(mod, 'createClient',
|
|
113
|
+
function(obj, args, lctx) {
|
|
114
|
+
|
|
115
|
+
},
|
|
116
|
+
function(obj, args, ret, lctx){
|
|
117
|
+
|
|
118
|
+
var proto = ret.__proto__;
|
|
119
|
+
|
|
120
|
+
var funcKeys = Object.keys(proto).map(function(key){
|
|
121
|
+
if(proto[key] && proto[key].constructor == Function) {
|
|
122
|
+
return key;
|
|
123
|
+
}
|
|
124
|
+
}).filter(function(key){ return key !== undefined })
|
|
125
|
+
|
|
126
|
+
var dbc_hash = undefined;
|
|
127
|
+
var dbc_string = undefined;
|
|
128
|
+
if(args.length > 1){
|
|
129
|
+
var conn = args[1];
|
|
130
|
+
if(conn.dbc_hash){
|
|
131
|
+
dbc_hash = conn.dbc_hash;
|
|
132
|
+
dbc_string = conn.dbc_string;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if(proto.__whatap_hook__ == true) return;
|
|
137
|
+
|
|
138
|
+
funcKeys.forEach(function(key){
|
|
139
|
+
var method_string = dbc_string + '/' + key;
|
|
140
|
+
var method_hash = HashUtil.hashFromString(method_string);
|
|
141
|
+
// DataTextAgent.DBC.add(dbc_hash, dbc);
|
|
142
|
+
DataTextAgent.METHOD.add(method_hash, method_string);
|
|
143
|
+
|
|
144
|
+
proto.__whatap_hook__ = true;
|
|
145
|
+
aop.both(proto, key , startThriftFunc(method_hash, self.agent) ,
|
|
146
|
+
endThriftFunc
|
|
147
|
+
)
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
var startThriftFunc = function (method_hash, agent) {
|
|
152
|
+
|
|
153
|
+
return function (obj, args) {
|
|
154
|
+
var ctx = TraceContextManager.getCurrentContext();
|
|
155
|
+
|
|
156
|
+
if (ctx == null || args[0] == null) { return; }
|
|
157
|
+
// if(args[0].sql == null && typeof args[0] != 'string') { return; }
|
|
158
|
+
|
|
159
|
+
var method_step = new MethodStepX();
|
|
160
|
+
method_step.start_time = ctx.getElapsedTime();
|
|
161
|
+
method_step.hash = method_hash;
|
|
162
|
+
|
|
163
|
+
ctx.profile.push(method_step);
|
|
164
|
+
// ctx.sql_count++;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
var endThriftFunc = function (obj, args, ret, lctx) {
|
|
169
|
+
|
|
170
|
+
if(args != undefined && args.length > 0 && args[args.length-1] !== undefined && args[args.length-1].constructor === Function){
|
|
171
|
+
agent.aop.functionHook(args, -1, endHook);
|
|
172
|
+
}else{
|
|
173
|
+
endHook();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function endHook(obj, args){
|
|
178
|
+
var ctx = TraceContextManager.getCurrentContext();
|
|
179
|
+
if(ctx == null ) { return; }
|
|
180
|
+
|
|
181
|
+
TraceContextManager.resume(ctx._id);
|
|
182
|
+
|
|
183
|
+
var laststep = ctx.profile.getLastSteps(1);
|
|
184
|
+
if(laststep == null || laststep.length == 0) { return; }
|
|
185
|
+
|
|
186
|
+
var step = laststep[0];
|
|
187
|
+
step.elapsed = ctx.getElapsedTime() - step.start_time;
|
|
188
|
+
ctx.sql_time += sql_step.elapsed;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
aop.after(mod, ['createPool', 'createPoolCluster'], function (obj, args, ret) {
|
|
192
|
+
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
exports.ThriftObserver = ThriftObserver;
|