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,332 @@
|
|
|
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 DataOutputX = require('../io/data-outputx'),
|
|
8
|
+
DataInputX = require('../io/data-inputx'),
|
|
9
|
+
Long = require('long') ,
|
|
10
|
+
EventLevel = require('../data/event-level');
|
|
11
|
+
function TxRecord() {
|
|
12
|
+
this.seq = Long.ZERO;
|
|
13
|
+
this.endTime =0;
|
|
14
|
+
this.service = 0;
|
|
15
|
+
this.elapsed = 0;
|
|
16
|
+
this.error = Long.ZERO;
|
|
17
|
+
this.cpuTime = 0;
|
|
18
|
+
this.malloc = 0;
|
|
19
|
+
|
|
20
|
+
this.sqlCount = 0;
|
|
21
|
+
this.sqlTime = 0;
|
|
22
|
+
this.sqlFetchCount = 0;
|
|
23
|
+
this.sqlFetchTime = 0;
|
|
24
|
+
|
|
25
|
+
this.httpcCount = 0;
|
|
26
|
+
this.httpcTime = 0;
|
|
27
|
+
this.active = false;
|
|
28
|
+
this.steps_data_pos = 0;
|
|
29
|
+
this.cipher = 0;
|
|
30
|
+
|
|
31
|
+
this.ipaddr = 0;
|
|
32
|
+
this.userid = Long.ZERO;
|
|
33
|
+
this.userAgent = 0;
|
|
34
|
+
this.referer = 0;
|
|
35
|
+
this.status = 0;
|
|
36
|
+
|
|
37
|
+
this.mtid = Long.ZERO;
|
|
38
|
+
this.mdepth = 0;
|
|
39
|
+
this.mcaller = Long.ZERO;
|
|
40
|
+
this.mcaller_txid = Long.ZERO;
|
|
41
|
+
|
|
42
|
+
this.mcaller_pcode = 0;
|
|
43
|
+
this.mcaller_okind = 0;
|
|
44
|
+
this.mcaller_oid = 0;
|
|
45
|
+
this.mcaller_spec = 0;
|
|
46
|
+
this.mcaller_url = 0;
|
|
47
|
+
this.mthis_spec = 0;
|
|
48
|
+
|
|
49
|
+
this.http_method = 0;
|
|
50
|
+
|
|
51
|
+
this.domain = 0;
|
|
52
|
+
this.fields = [];
|
|
53
|
+
|
|
54
|
+
this.login=0;
|
|
55
|
+
this.errorLevel=0;
|
|
56
|
+
|
|
57
|
+
this.oid=0;
|
|
58
|
+
this.okind=0;
|
|
59
|
+
this.onode=0;
|
|
60
|
+
|
|
61
|
+
this.custid=null;
|
|
62
|
+
this.dbcTime=0;
|
|
63
|
+
this.apdex=0;
|
|
64
|
+
|
|
65
|
+
this.mcallerStepId = Long.ZERO;
|
|
66
|
+
this.originUrl = null;
|
|
67
|
+
|
|
68
|
+
this.step_split_count = 0;
|
|
69
|
+
|
|
70
|
+
this.methodCount = 0;
|
|
71
|
+
this.methodTime = 0;
|
|
72
|
+
|
|
73
|
+
this.appctx = "";
|
|
74
|
+
this.txName = "";
|
|
75
|
+
this.error_class = "";
|
|
76
|
+
this.error_message = "";
|
|
77
|
+
}
|
|
78
|
+
TxRecord.prototype.getServiceType = function() {return 0;};
|
|
79
|
+
|
|
80
|
+
TxRecord.prototype.write = function(dout) {
|
|
81
|
+
dout.writeByte(10); //version
|
|
82
|
+
|
|
83
|
+
var o = new DataOutputX();
|
|
84
|
+
o.writeLong(this.seq);
|
|
85
|
+
o.writeDecimal(this.endTime);
|
|
86
|
+
o.writeDecimal(this.service);
|
|
87
|
+
o.writeDecimal(this.elapsed);
|
|
88
|
+
o.writeDecimal(this.error);
|
|
89
|
+
o.writeDecimal(this.cpuTime);
|
|
90
|
+
o.writeDecimal(this.malloc);
|
|
91
|
+
|
|
92
|
+
o.writeDecimal(this.sqlCount);
|
|
93
|
+
o.writeDecimal(this.sqlTime);
|
|
94
|
+
o.writeDecimal(this.sqlFetchCount);
|
|
95
|
+
o.writeDecimal(this.sqlFetchTime);
|
|
96
|
+
|
|
97
|
+
o.writeDecimal(this.httpcCount);
|
|
98
|
+
o.writeDecimal(this.httpcTime);
|
|
99
|
+
|
|
100
|
+
o.writeBoolean(this.active);
|
|
101
|
+
o.writeDecimal(this.steps_data_pos);
|
|
102
|
+
o.writeDecimal(this.cipher);
|
|
103
|
+
|
|
104
|
+
o.writeInt(this.ipaddr);
|
|
105
|
+
o.writeDecimal(this.userid);
|
|
106
|
+
o.writeDecimal(this.userAgent);
|
|
107
|
+
o.writeDecimal(this.referer);
|
|
108
|
+
o.writeDecimal(this.status);
|
|
109
|
+
|
|
110
|
+
if(this.mtid.isZero()==false){
|
|
111
|
+
o.writeByte(1);
|
|
112
|
+
o.writeDecimal(this.mtid);
|
|
113
|
+
o.writeDecimal(this.mdepth);
|
|
114
|
+
o.writeDecimal(this.mcaller);
|
|
115
|
+
}else{
|
|
116
|
+
o.writeByte(0);
|
|
117
|
+
}
|
|
118
|
+
if(this.mcaller_pcode!=0) {
|
|
119
|
+
o.writeByte(6);
|
|
120
|
+
o.writeDecimal(this.mcaller_pcode);
|
|
121
|
+
o.writeDecimal(this.mcaller_okind);
|
|
122
|
+
o.writeDecimal(this.mcaller_oid);
|
|
123
|
+
o.writeDecimal(this.mcaller_spec);
|
|
124
|
+
o.writeDecimal(this.mcaller_url);
|
|
125
|
+
o.writeDecimal(this.mthis_spec);//보통 0, 서버에서 셋팅
|
|
126
|
+
}else {
|
|
127
|
+
o.writeByte(0);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
o.writeByte(this.http_method);
|
|
131
|
+
o.writeDecimal(this.domain);
|
|
132
|
+
|
|
133
|
+
if (this.fields == null || this.fields.length==0) {
|
|
134
|
+
o.writeByte(0);
|
|
135
|
+
} else {
|
|
136
|
+
var sz = this.fields.length;
|
|
137
|
+
o.writeByte(sz);
|
|
138
|
+
for (var i = 0; i < sz; i++) {
|
|
139
|
+
o.writeByte(this.fields[i].id);
|
|
140
|
+
o.writeText(this.fields[i].value);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
o.writeDecimal(this.login);
|
|
144
|
+
o.writeByte(this.errorLevel);
|
|
145
|
+
|
|
146
|
+
// 2018.12.28
|
|
147
|
+
o.writeDecimal(this.oid);
|
|
148
|
+
o.writeDecimal(this.okind);
|
|
149
|
+
o.writeDecimal(this.onode);
|
|
150
|
+
|
|
151
|
+
o.writeText(this.custid);
|
|
152
|
+
o.writeDecimal(this.dbcTime);
|
|
153
|
+
o.writeByte(this.apdex);
|
|
154
|
+
|
|
155
|
+
o.writeDecimal(this.mcallerStepId);
|
|
156
|
+
o.writeText(this.originUrl);
|
|
157
|
+
|
|
158
|
+
o.writeDecimal(this.step_split_count);
|
|
159
|
+
|
|
160
|
+
o.writeDecimal(this.methodCount);
|
|
161
|
+
o.writeDecimal(this.methodTime);
|
|
162
|
+
|
|
163
|
+
o.writeText(this.appctx);
|
|
164
|
+
o.writeText(this.txName);
|
|
165
|
+
o.writeText(this.error_class);
|
|
166
|
+
o.writeText(this.error_message);
|
|
167
|
+
|
|
168
|
+
////////////// BLOB ///////////////
|
|
169
|
+
dout.writeBlob(o.toByteArray());
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
TxRecord.prototype.read = function(din) {
|
|
173
|
+
var ver = din.readByte();
|
|
174
|
+
if(ver <10){
|
|
175
|
+
throw new Error('TxRecord has invalid version='+ver);
|
|
176
|
+
}
|
|
177
|
+
var i = new DataInputX(din.readBlob());
|
|
178
|
+
this.seq = i.readLong();
|
|
179
|
+
this.endTime = i.readDecNumber();
|
|
180
|
+
this.service = i.readDecNumber();
|
|
181
|
+
this.elapsed = i.readDecNumber();
|
|
182
|
+
this.error = i.readDecimal();
|
|
183
|
+
|
|
184
|
+
this.cpuTime = i.readDecNumber();
|
|
185
|
+
this.malloc = i.readDecNumber();
|
|
186
|
+
|
|
187
|
+
this.sqlCount = i.readDecNumber();
|
|
188
|
+
this.sqlTime = i.readDecNumber();
|
|
189
|
+
this.sqlFetchCount = i.readDecNumber();
|
|
190
|
+
this.sqlFetchTime = i.readDecNumber();
|
|
191
|
+
|
|
192
|
+
this.httpcCount = i.readDecNumber();
|
|
193
|
+
this.httpcTime = i.readDecNumber();
|
|
194
|
+
|
|
195
|
+
this.active = i.readBoolean();
|
|
196
|
+
this.steps_data_pos = i.readDecNumber();
|
|
197
|
+
this.cipher = i.readDecNumber();
|
|
198
|
+
|
|
199
|
+
this.ipaddr = i.readInt();
|
|
200
|
+
this.userid = i.readDecLong();
|
|
201
|
+
this.userAgent = i.readDecNumber();
|
|
202
|
+
this.referer = i.readDecNumber();
|
|
203
|
+
this.status = i.readDecNumber();
|
|
204
|
+
|
|
205
|
+
if(i.readByte() >0){
|
|
206
|
+
this.mtid = i.readDecLong();
|
|
207
|
+
this.mdepth = i.readDecNumber();
|
|
208
|
+
this.mcaller_txid = i.readDecLong();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
switch (i.readByte()) {
|
|
212
|
+
case 1:
|
|
213
|
+
this.mcaller_pcode = i.readDecNumber();
|
|
214
|
+
break;
|
|
215
|
+
case 3:
|
|
216
|
+
this.mcaller_pcode = i.readDecNumber();
|
|
217
|
+
this.mcaller_spec = i.readDecNumber();
|
|
218
|
+
this.mcaller_url = i.readDecNumber();
|
|
219
|
+
break;
|
|
220
|
+
case 4:
|
|
221
|
+
this.mcaller_pcode = i.readDecNumber();
|
|
222
|
+
this.mcaller_spec = i.readDecNumber();
|
|
223
|
+
this.mcaller_url = i.readDecNumber();
|
|
224
|
+
this.mthis_spec = i.readDecNumber();
|
|
225
|
+
break;
|
|
226
|
+
case 5:
|
|
227
|
+
this.mcaller_pcode = i.readDecNumber();
|
|
228
|
+
this.mcaller_oid = i.readDecNumber();
|
|
229
|
+
this.mcaller_spec = i.readDecNumber();
|
|
230
|
+
this.mcaller_url = i.readDecNumber();
|
|
231
|
+
this.mthis_spec = i.readDecNumber();
|
|
232
|
+
break;
|
|
233
|
+
case 6:
|
|
234
|
+
this.mcaller_pcode = i.readDecNumber();
|
|
235
|
+
this.mcaller_okind = i.readDecNumber();
|
|
236
|
+
this.mcaller_oid = i.readDecNumber();
|
|
237
|
+
this.mcaller_spec = i.readDecNumber();
|
|
238
|
+
this.mcaller_url = i.readDecNumber();
|
|
239
|
+
this.mthis_spec = i.readDecNumber();
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
this.http_method = i.readByte();
|
|
243
|
+
this.domain = i.readDecNumber();
|
|
244
|
+
|
|
245
|
+
var n = i.readByte();
|
|
246
|
+
if (n > 0) {
|
|
247
|
+
this.fields = new Array(n);
|
|
248
|
+
for (var c = 0; c < n; c++) {
|
|
249
|
+
var id = i.readByte();
|
|
250
|
+
var value = i.readText();
|
|
251
|
+
this.fields[i] = {
|
|
252
|
+
id: id,
|
|
253
|
+
value: value
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (i.available() > 0) {
|
|
259
|
+
this.login = i.readDecNumber();
|
|
260
|
+
}
|
|
261
|
+
if (i.available() > 0) {
|
|
262
|
+
this.errorLevel = i.readByte();
|
|
263
|
+
} else {
|
|
264
|
+
if (this.error != 0) {
|
|
265
|
+
this.errorLevel = EventLevel.WARNING;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if(i.available()>0) {
|
|
269
|
+
this.oid = i.readDecNumber();
|
|
270
|
+
this.okind = i.readDecNumber();
|
|
271
|
+
this.onode = i.readDecNumber();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (i.available() > 0) {
|
|
275
|
+
this.custid = i.readText();
|
|
276
|
+
}
|
|
277
|
+
if (i.available() > 0) {
|
|
278
|
+
this.dbcTime = i.readDecNumber();
|
|
279
|
+
}
|
|
280
|
+
if (i.available() > 0) {
|
|
281
|
+
this.apdex = i.readByte();
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if(i.available()>0) {
|
|
285
|
+
this.mcallerStepId=i.readDecNumber();
|
|
286
|
+
this.originUrl=i.readText();
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (i.available() > 0) {
|
|
290
|
+
this.step_split_count = i.readDecimal();
|
|
291
|
+
}
|
|
292
|
+
if (i.available() > 0) {
|
|
293
|
+
this.methodCount = i.readDecimal();
|
|
294
|
+
this.methodTime = i.readDecimal();
|
|
295
|
+
}
|
|
296
|
+
if(i.available()>0) {
|
|
297
|
+
this.appctx=i.readText();
|
|
298
|
+
}
|
|
299
|
+
if(i.available()>0) {
|
|
300
|
+
this.txName=i.readText();
|
|
301
|
+
}
|
|
302
|
+
if(i.available()>0) {
|
|
303
|
+
this.error_class = i.readText();
|
|
304
|
+
this.error_message = i.readText();
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return this;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
TxRecord.prototype.toBytes = function() {
|
|
311
|
+
var dout = new DataOutputX();
|
|
312
|
+
this.write(dout);
|
|
313
|
+
return dout.toByteArray();
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
TxRecord.prototype.toObject = function(b) {
|
|
317
|
+
var din = new DataInputX(b);
|
|
318
|
+
this.read(din);
|
|
319
|
+
return service;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
TxRecord.HTTP_METHOD={"GET":1,"POST":2,"PUT":3,"DELETE":4,"PATCH":5,"OPTIONS":6,"HEAD":7,"TRACE":8};
|
|
323
|
+
TxRecord.WEB_GET = 1;
|
|
324
|
+
TxRecord.WEB_POST = 2;
|
|
325
|
+
TxRecord.WEB_PUT = 3;
|
|
326
|
+
TxRecord.WEB_DELETE = 4;
|
|
327
|
+
TxRecord.WEB_PATCH = 5;
|
|
328
|
+
TxRecord.WEB_OPTIONS = 6;
|
|
329
|
+
TxRecord.WEB_HEAD = 7;
|
|
330
|
+
TxRecord.WEB_TRACE = 8;
|
|
331
|
+
|
|
332
|
+
module.exports = TxRecord;
|
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
|
|
8
|
+
var ErrorData = require('../util/errordata'),
|
|
9
|
+
BitUtil = require('../util/bitutil'),
|
|
10
|
+
ErrorSnapPack1 = require('../pack/errorsnap-pack'),
|
|
11
|
+
StatErrorPack = require('../pack/staterror-pack').StatErrorPack,
|
|
12
|
+
ErrorRec = require('../pack/staterror-pack').ErrorRec,
|
|
13
|
+
hashUtil = require('../util/hashutil'),
|
|
14
|
+
LinkedMap = require('../util/linkedmap'),
|
|
15
|
+
DataTextAgent = require('../data/datatext-agent'),
|
|
16
|
+
Logger = require('../logger'),
|
|
17
|
+
Long = require('long');
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var DataPackSender = require('../data/datapack-sender');
|
|
21
|
+
|
|
22
|
+
var ERROR_SNAP_SEQ = Long.fromNumber(Date.now());
|
|
23
|
+
var TABLE_MAX_SIZE = 1000;
|
|
24
|
+
|
|
25
|
+
function StatError() {
|
|
26
|
+
this.conf = require('../conf/configure');
|
|
27
|
+
this.table = new LinkedMap(TABLE_MAX_SIZE + 1, 1).setMax(TABLE_MAX_SIZE);
|
|
28
|
+
this.table.hash = function (k) {
|
|
29
|
+
if(k._hash_){
|
|
30
|
+
return k._hash_;
|
|
31
|
+
}
|
|
32
|
+
var result = 1;
|
|
33
|
+
result = 31 * result + k.class;
|
|
34
|
+
result = 31 * result + k.service;
|
|
35
|
+
|
|
36
|
+
k._hash_=result;
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
this.table.equals = function (k1,k2) {
|
|
40
|
+
return k1.class === k2.class && k1.service === k2.service;
|
|
41
|
+
}
|
|
42
|
+
this.table.create=function(key){
|
|
43
|
+
if(this.isFull()) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
rec = new ErrorRec();
|
|
47
|
+
rec.classHash = key.class;
|
|
48
|
+
rec.service = key.service;
|
|
49
|
+
return rec;
|
|
50
|
+
}
|
|
51
|
+
this.error = {};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function nextErrorSnapSeq(){
|
|
55
|
+
ERROR_SNAP_SEQ = ERROR_SNAP_SEQ.add(1);
|
|
56
|
+
return ERROR_SNAP_SEQ;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// StatError.prototype.addErrorForStep = function(thr, dbc, service, steps, stackTrace) {
|
|
60
|
+
// var error_data = new ErrorData(thr, 0, txUrlHash, profile, true); // notdol: error데이터 객체를 만드는 의미가 없음
|
|
61
|
+
// var error_snap_pack = new ErrorSnapPack1(); // notdol: errorSnappack을 만드는 의미가 없음
|
|
62
|
+
// error_snap_pack.setProfile(error_data.profile);
|
|
63
|
+
|
|
64
|
+
// var rec = this.table.get({class: dbc, service : service});
|
|
65
|
+
// if(rec){
|
|
66
|
+
// rec.count++;
|
|
67
|
+
// }
|
|
68
|
+
// };
|
|
69
|
+
StatError.prototype.addError = function(class1, msg, txUrlHash, appendTextType, appendTextHash) {
|
|
70
|
+
try {
|
|
71
|
+
if(typeof class1 ==='number'){
|
|
72
|
+
class1 = class1.toString();
|
|
73
|
+
}
|
|
74
|
+
var classHash = hashUtil.hashFromString(class1);
|
|
75
|
+
DataTextAgent.ERROR.add(classHash, class1);
|
|
76
|
+
|
|
77
|
+
var msgHash = hashUtil.hashFromString(msg);
|
|
78
|
+
DataTextAgent.ERROR.add(msgHash, msg);
|
|
79
|
+
|
|
80
|
+
var key = {class: classHash, service : txUrlHash};
|
|
81
|
+
var rec = this.table.intern(key);
|
|
82
|
+
if (rec) {
|
|
83
|
+
rec.msg = msgHash;
|
|
84
|
+
rec.count++;
|
|
85
|
+
if (appendTextType && rec.snapSeq == 0 && this.conf.error_snap_enabled===true) {
|
|
86
|
+
var p = new ErrorSnapPack1();
|
|
87
|
+
p.seq = nextErrorSnapSeq();
|
|
88
|
+
rec.snapSeq = p.seq;
|
|
89
|
+
rec.msg = msgHash;
|
|
90
|
+
|
|
91
|
+
p.append_type = appendTextType;
|
|
92
|
+
p.append_hash = appendTextHash;
|
|
93
|
+
DataPackSender.sendErrorSnapPack(p);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return BitUtil.composite(classHash,msgHash);
|
|
97
|
+
} catch(e) {
|
|
98
|
+
Logger.printError('WHATAP-996', 'StatError (addError)', e, false);
|
|
99
|
+
}
|
|
100
|
+
return Long.ZERO;
|
|
101
|
+
};
|
|
102
|
+
StatError.prototype.send = function(now) {
|
|
103
|
+
if (this.table.size() === 0)
|
|
104
|
+
return;
|
|
105
|
+
|
|
106
|
+
var statError = new StatErrorPack().setRecords(this.table.size(), this.table.values());
|
|
107
|
+
statError.time = now;
|
|
108
|
+
this.table.clear();
|
|
109
|
+
|
|
110
|
+
DataPackSender.sendStatErrorPack(statError);
|
|
111
|
+
};
|
|
112
|
+
StatError.prototype.clear = function () {
|
|
113
|
+
this.table.clear();
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
module.exports = new StatError();
|
|
@@ -0,0 +1,98 @@
|
|
|
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 LinkedMap = require('../util/linkedmap'),
|
|
8
|
+
StatHttpcPack = require('../pack/stathttpc-pack'),
|
|
9
|
+
HttpcRec = require('../pack/stathttpc-rec'),
|
|
10
|
+
DataPackSender = require('../data/datapack-sender'),
|
|
11
|
+
Logger = require('../logger');
|
|
12
|
+
|
|
13
|
+
const TABLE_MAX_SIZE = 5000;
|
|
14
|
+
|
|
15
|
+
function HTTPC(url, host, port) {
|
|
16
|
+
this.url = url || 0;
|
|
17
|
+
this.host = host || 0;
|
|
18
|
+
this.port = port || 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
HTTPC.prototype.hashCode = function () {
|
|
22
|
+
var prime = 31;
|
|
23
|
+
var result = 1;
|
|
24
|
+
result = prime * result + this.host;
|
|
25
|
+
result = prime * result + this.port;
|
|
26
|
+
result = prime * result + this.url;
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
HTTPC.prototype.equals = function (other) {
|
|
30
|
+
if(this === other) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if(other == null) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return this.host === other.host && this.url === other.url && this.port === other.port;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function StatHttpc() {
|
|
40
|
+
if(typeof StatHttpc.instance === 'object') {
|
|
41
|
+
return StatHttpc.instance;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
this.table = new LinkedMap(TABLE_MAX_SIZE + 1 , 1).setMax(TABLE_MAX_SIZE);
|
|
45
|
+
this.table.create = function (key) {
|
|
46
|
+
if(this.size() >= TABLE_MAX_SIZE) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
var rec = new HttpcRec();
|
|
50
|
+
rec.url = key.url;
|
|
51
|
+
rec.host = key.host;
|
|
52
|
+
rec.port = key.port;
|
|
53
|
+
rec.time_min = Number.MAX_SAFE_INTEGER;
|
|
54
|
+
return rec;
|
|
55
|
+
};
|
|
56
|
+
StatHttpc.instance = this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
StatHttpc.prototype.getHttpc = function (url, host, port) {
|
|
60
|
+
return this.table.intern(new HTTPC(url, host, port));
|
|
61
|
+
};
|
|
62
|
+
StatHttpc.prototype.addHttpcTime = function (service_hash, httpc_url_hash, httpc_host, httpc_port, time, isErr) {
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
if(httpc_url_hash === 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var httpcRec = this.getHttpc(httpc_url_hash, httpc_host, httpc_port);
|
|
70
|
+
if(httpcRec != null) {
|
|
71
|
+
httpcRec.count_total++;
|
|
72
|
+
httpcRec.time_sum +=time;
|
|
73
|
+
httpcRec.time_std +=time * time;
|
|
74
|
+
httpcRec.time_max = Math.max(httpcRec.time_max, time);
|
|
75
|
+
httpcRec.time_min = Math.min(httpcRec.time_min, time);
|
|
76
|
+
if (isErr) {
|
|
77
|
+
httpcRec.count_error++;
|
|
78
|
+
}
|
|
79
|
+
httpcRec.service = service_hash;
|
|
80
|
+
}
|
|
81
|
+
} catch(e) {
|
|
82
|
+
Logger.printError("WHATAP-610", "StatHttpC addHttpcTime error", e, false);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
StatHttpc.prototype.send = function (now) {
|
|
86
|
+
if(this.table.size() === 0) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
var p = new StatHttpcPack().setRecords(this.table.size(), this.table.values());
|
|
90
|
+
p.time = now;
|
|
91
|
+
this.table.clear();
|
|
92
|
+
DataPackSender.sendStatHttpcPack(p);
|
|
93
|
+
};
|
|
94
|
+
StatHttpc.prototype.clear = function () {
|
|
95
|
+
this.table.clear();
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
module.exports = new StatHttpc();
|
|
@@ -0,0 +1,46 @@
|
|
|
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 StatRemoteIpPack = require('../pack/statremote-pack'),
|
|
8
|
+
DataPackSender = require('../data/datapack-sender');
|
|
9
|
+
|
|
10
|
+
var TABLE_MAX_SIZE = 70000;
|
|
11
|
+
|
|
12
|
+
function StatRemoteIp() {
|
|
13
|
+
if(typeof StatRemoteIp.instance === 'object') {
|
|
14
|
+
return StatRemoteIp.instance;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
this.table = new StatRemoteIpPack();
|
|
18
|
+
this.table.iptable.setMax(TABLE_MAX_SIZE);
|
|
19
|
+
|
|
20
|
+
StatRemoteIp.instance = this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
StatRemoteIp.prototype.incRemoteIp = function (ip) {
|
|
24
|
+
if(ip) {
|
|
25
|
+
this.table.iptable.addNoOver(ip,1);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
StatRemoteIp.prototype.send = function (now) {
|
|
29
|
+
if(this.table.iptable.size() === 0) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var p = this.table;
|
|
34
|
+
p.time = now;
|
|
35
|
+
DataPackSender.sendStatRemoteIpPack(p);
|
|
36
|
+
|
|
37
|
+
this.table = new StatRemoteIpPack();
|
|
38
|
+
this.table.iptable.setMax(TABLE_MAX_SIZE);
|
|
39
|
+
};
|
|
40
|
+
StatRemoteIp.prototype.clear = function () {
|
|
41
|
+
this.table.iptable.clear();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
module.exports = new StatRemoteIp();
|
|
45
|
+
|
|
46
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const StatGeneralPack = require('../pack/stat-general-pack');
|
|
2
|
+
const LongKeyLinkedMap = require('../util/longkey-linkedmap');
|
|
3
|
+
const TimeCount = require('../pack/time-count');
|
|
4
|
+
const conf = require('../conf/configure');
|
|
5
|
+
const BitUtil = require('../util/bitutil');
|
|
6
|
+
const ZipProfile = require('../data/zipprofile');
|
|
7
|
+
const DataPackSender = require('../data/datapack-sender');
|
|
8
|
+
const AnyList = require('../util/anylist');
|
|
9
|
+
|
|
10
|
+
var TABLE_MAX_SIZE = 10000;
|
|
11
|
+
|
|
12
|
+
function StatRemoteIpurl() {
|
|
13
|
+
if (typeof StatRemoteIpurl.instance === 'object') {
|
|
14
|
+
return StatRemoteIpurl.instance;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
this.TABLE_MAX_SIZE = TABLE_MAX_SIZE;
|
|
18
|
+
this.table = new LongKeyLinkedMap(TABLE_MAX_SIZE + 1, 1).setMax(TABLE_MAX_SIZE);
|
|
19
|
+
this.table.create = function (key) {
|
|
20
|
+
return new TimeCount();
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
StatRemoteIpurl.instance = this;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
StatRemoteIpurl.prototype.getService = function (ip, url_hash) {
|
|
27
|
+
var key = BitUtil.composite(ip, url_hash);
|
|
28
|
+
if (this.table.size() < conf.getProperty('stat_ipurl_max_count', 10000)) {
|
|
29
|
+
return this.table.intern(key);
|
|
30
|
+
} else {
|
|
31
|
+
return this.table.get(key);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
StatRemoteIpurl.prototype.send = function (now) {
|
|
36
|
+
if (this.table.size() === 0) return;
|
|
37
|
+
|
|
38
|
+
var currTable = this.table;
|
|
39
|
+
var sz = Math.max(this.TABLE_MAX_SIZE, conf.getProperty('stat_ipurl_max_count', 10000));
|
|
40
|
+
this.table = new LongKeyLinkedMap(sz + 1, 1).setMax(conf.getProperty('stat_ipurl_max_count', 10000));
|
|
41
|
+
this.table.create = function (key) {
|
|
42
|
+
return new TimeCount();
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var rsize = this.table.size();
|
|
46
|
+
var ip = new AnyList(AnyList.INT, rsize);
|
|
47
|
+
var url = new AnyList(AnyList.INT, rsize);
|
|
48
|
+
var count = new AnyList(AnyList.INT, rsize);
|
|
49
|
+
var error = new AnyList(AnyList.INT, rsize);
|
|
50
|
+
var time = new AnyList(AnyList.LONG, rsize);
|
|
51
|
+
|
|
52
|
+
var entries = currTable.entries();
|
|
53
|
+
var i = 0;
|
|
54
|
+
while(entries.hasMoreElements()){
|
|
55
|
+
var ent = entries.nextElement();
|
|
56
|
+
var k = ent.getKey();
|
|
57
|
+
var v = ent.getValue();
|
|
58
|
+
|
|
59
|
+
ip.put(i, BitUtil.getHigh(k));
|
|
60
|
+
url.put(i, BitUtil.getLow(k));
|
|
61
|
+
count.put(i, v.count);
|
|
62
|
+
error.put(i, v.error);
|
|
63
|
+
time.put(i, v.time);
|
|
64
|
+
i++;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const out = new StatGeneralPack();
|
|
68
|
+
out.put("ip", ip);
|
|
69
|
+
out.put("url", url);
|
|
70
|
+
out.put("count", count);
|
|
71
|
+
out.put("error", error);
|
|
72
|
+
out.put("time", time);
|
|
73
|
+
|
|
74
|
+
out.id = "ip-url";
|
|
75
|
+
out.time = now;
|
|
76
|
+
|
|
77
|
+
DataPackSender.sendStatRemoteIpUrlPack(out);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
StatRemoteIpurl.prototype.clear = function () {
|
|
81
|
+
this.table.clear();
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
StatRemoteIpurl.prototype.size = function () {
|
|
85
|
+
return this.table.size();
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
module.exports = new StatRemoteIpurl();
|