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,292 @@
|
|
|
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 Pack = require('./pack'),
|
|
8
|
+
PackEnum = require('./packenum'),
|
|
9
|
+
IntKeyLinkedMap = require('../util/intkey-linkedmap'),
|
|
10
|
+
DataOutputX = require('../io/data-outputx'),
|
|
11
|
+
DataInputX = require('../io/data-inputx'),
|
|
12
|
+
IntKeyMap = require('../util/intkey-map'),
|
|
13
|
+
TimeCount = require('./time-count');
|
|
14
|
+
|
|
15
|
+
function TransactionRec() {
|
|
16
|
+
this.hash = 0; /*int*/
|
|
17
|
+
|
|
18
|
+
this.count = 0; /*int*/
|
|
19
|
+
this.error = 0; /*int*/
|
|
20
|
+
|
|
21
|
+
this.time_sum = 0; /*long*/
|
|
22
|
+
this.time_max = 0; /*int*/
|
|
23
|
+
|
|
24
|
+
this.sql_count = 0; /*int*/
|
|
25
|
+
this.sql_time = 0; /*long*/
|
|
26
|
+
this.sql_fetch = 0; /*int*/
|
|
27
|
+
this.sql_fetch_time = 0; /*long*/
|
|
28
|
+
|
|
29
|
+
this.httpc_count = 0; /*int*/
|
|
30
|
+
this.httpc_time = 0; /*long*/
|
|
31
|
+
this.malloc_sum = 0; /*long*/
|
|
32
|
+
this.cpu_sum = 0; /*long*/
|
|
33
|
+
|
|
34
|
+
this.sqlMap = null; // int-key-map
|
|
35
|
+
this.httpcMap = null; // int-key-map
|
|
36
|
+
|
|
37
|
+
/*임시변수 서버전송 안함*/
|
|
38
|
+
this.profiled = false;
|
|
39
|
+
|
|
40
|
+
this.apdex_satisfied = 0; /*int*/
|
|
41
|
+
this.apdex_tolerated = 0; /*int*/
|
|
42
|
+
|
|
43
|
+
this.time_min = 0; /*int*/
|
|
44
|
+
this.time_std = Long.ZERO; /*long*/
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
TransactionRec.prototype.mergeForStat = function(o){
|
|
48
|
+
this.count += o.count;
|
|
49
|
+
this.error += o.error;
|
|
50
|
+
|
|
51
|
+
this.time_sum +=o.time_sum;
|
|
52
|
+
this.time_max = Math.max(this.time_max, o.time_max);
|
|
53
|
+
|
|
54
|
+
this.sql_count += o.sql_count;
|
|
55
|
+
this.sql_time +=o.sql_time;
|
|
56
|
+
this.sql_fetch += o.sql_fetch;
|
|
57
|
+
this.sql_fetch_time +=o.sql_fetch_time;
|
|
58
|
+
|
|
59
|
+
this.httpc_count += o.httpc_count;
|
|
60
|
+
this.httpc_time +=o.httpc_time;
|
|
61
|
+
|
|
62
|
+
this.malloc_sum +=o.malloc_sum;
|
|
63
|
+
this.cpu_sum +=o.cpu_sum;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
TransactionRec.prototype.merge = function(o) {
|
|
67
|
+
this.mergeForStat(o);
|
|
68
|
+
|
|
69
|
+
if(o.sqlMap !== undefined && o.sqlMap.size() > 0){
|
|
70
|
+
if (this.sqlMap == undefined) {
|
|
71
|
+
this.sqlMap = createMap(o.sqlMap.size());
|
|
72
|
+
var en = o.sqlMap.entries();
|
|
73
|
+
while (en.hasMoreElements()) {
|
|
74
|
+
var e = en.nextElement();
|
|
75
|
+
this.sqlMap.put(e.getKey(), e.getValue().copy());
|
|
76
|
+
}
|
|
77
|
+
}else{
|
|
78
|
+
var en = o.sqlMap.entries();
|
|
79
|
+
while (en.hasMoreElements()) {
|
|
80
|
+
var e = en.nextElement();
|
|
81
|
+
var tc = this.sqlMap.get(e.getKey());
|
|
82
|
+
if (!tc) {
|
|
83
|
+
this.sqlMap.put(e.getKey(), e.getValue().copy());
|
|
84
|
+
} else {
|
|
85
|
+
tc.merge(e.getValue());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
TransactionRec.prototype.setUrlHash = function(hash) {
|
|
93
|
+
this.hash = hash;
|
|
94
|
+
return this;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
TransactionRec.prototype.write = function(dout) {
|
|
98
|
+
dout.writeInt(this.hash);
|
|
99
|
+
dout.writeByte(2);
|
|
100
|
+
dout.writeDecimal(this.count);
|
|
101
|
+
dout.writeDecimal(this.error);
|
|
102
|
+
dout.writeDecimal(this.time_sum);
|
|
103
|
+
dout.writeDecimal(this.time_max);
|
|
104
|
+
|
|
105
|
+
dout.writeDecimal(this.sql_count);
|
|
106
|
+
dout.writeDecimal(this.sql_time);
|
|
107
|
+
dout.writeDecimal(this.sql_fetch);
|
|
108
|
+
dout.writeDecimal(this.sql_fetch_time);
|
|
109
|
+
|
|
110
|
+
dout.writeDecimal(this.httpc_count);
|
|
111
|
+
dout.writeDecimal(this.httpc_time);
|
|
112
|
+
dout.writeDecimal(this.malloc_sum);
|
|
113
|
+
dout.writeDecimal(this.cpu_sum);
|
|
114
|
+
|
|
115
|
+
dout.writeDecimal(0);
|
|
116
|
+
dout.writeDecimal(0);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
TransactionRec.prototype.read = function(din) {
|
|
120
|
+
this.hash = din.readInt();
|
|
121
|
+
var ver = din.readByte();
|
|
122
|
+
this.count = din.readDecNumber();
|
|
123
|
+
this.error = din.readDecNumber();
|
|
124
|
+
this.time_sum = din.readDecNumber();
|
|
125
|
+
this.time_max = din.readDecNumber();
|
|
126
|
+
|
|
127
|
+
this.sql_count = din.readDecNumber();
|
|
128
|
+
this.sql_time = din.readDecNumber();
|
|
129
|
+
this.sql_fetch = din.readDecNumber();
|
|
130
|
+
this.sql_fetch_time = din.readDecNumber();
|
|
131
|
+
|
|
132
|
+
this.httpc_count = din.readDecNumber();
|
|
133
|
+
this.httpc_time = din.readDecNumber();
|
|
134
|
+
this.malloc_sum = din.readDecNumber();
|
|
135
|
+
this.cpu_sum = din.readDecNumber();
|
|
136
|
+
|
|
137
|
+
_drop(din);
|
|
138
|
+
_drop(din);
|
|
139
|
+
/*
|
|
140
|
+
var sqlcnt = din.readDecimal();
|
|
141
|
+
if (sqlcnt > 0) {
|
|
142
|
+
this.sqlMap = createMap(sqlcnt);
|
|
143
|
+
for (var i = 0; i < sqlcnt; i++) {
|
|
144
|
+
var hash = din.readInt();
|
|
145
|
+
this.sqlMap.put(hash, new TimeCount().read(din));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
var httpcnt = din.readDecimal();
|
|
149
|
+
if (httpcnt > 0) {
|
|
150
|
+
this.httpcMap = createMap(httpcnt);
|
|
151
|
+
for (var i = 0; i < httpcnt; i++) {
|
|
152
|
+
var hash = din.readInt();
|
|
153
|
+
this.httpcMap.put(hash, new TimeCount().read(din));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if(ver <=2) return this;
|
|
158
|
+
this.apdex_satisfied= din.readDecimal();
|
|
159
|
+
this.apdex_tolerated= din.readDecimal();
|
|
160
|
+
|
|
161
|
+
if(ver <=3) return this;
|
|
162
|
+
this.time_min= din.readDecimal();
|
|
163
|
+
this.time_std= din.readDecimal();
|
|
164
|
+
*/
|
|
165
|
+
return this;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
TransactionRec.readRec = function(din){
|
|
169
|
+
var urlHash = din.readInt();
|
|
170
|
+
var ver = din.readByte();
|
|
171
|
+
|
|
172
|
+
if(ver <= 1){
|
|
173
|
+
var profiled = (ver==1);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
var m = new TransactionRec();
|
|
178
|
+
m.hash = urlHash;
|
|
179
|
+
m.count = din.readDecimal();
|
|
180
|
+
m.error = din.readDecimal();
|
|
181
|
+
m.time_sum = din.readDecimal();
|
|
182
|
+
m.time_max = din.readDecimal();
|
|
183
|
+
|
|
184
|
+
m.sql_count = din.readDecimal();
|
|
185
|
+
m.sql_time = din.readDecimal();
|
|
186
|
+
m.sql_fetch = din.readDecimal();
|
|
187
|
+
m.sql_fetch_time = din.readDecimal();
|
|
188
|
+
|
|
189
|
+
m.httpc_count = din.readDecimal();
|
|
190
|
+
m.httpc_time = din.readDecimal();
|
|
191
|
+
m.malloc_sum = din.readDecimal();
|
|
192
|
+
m.cpu_sum = din.readDecimal();
|
|
193
|
+
|
|
194
|
+
var sqlcnt = din.readDecimal();
|
|
195
|
+
if (sqlcnt > 0) {
|
|
196
|
+
m.sqlMap = createMap(sqlcnt);
|
|
197
|
+
for (var i = 0; i < sqlcnt; i++) {
|
|
198
|
+
var hash = din.readInt();
|
|
199
|
+
m.sqlMap.put(hash, new TimeCount().read(din));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
var httpcnt = din.readDecimal();
|
|
203
|
+
if (httpcnt > 0) {
|
|
204
|
+
m.httpcMap = createMap(httpcnt);
|
|
205
|
+
for (var i = 0; i < httpcnt; i++) {
|
|
206
|
+
var hash = din.readInt();
|
|
207
|
+
m.httpcMap.put(hash, new TimeCount().read(din));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/*
|
|
211
|
+
if(ver <=2) return m;
|
|
212
|
+
m.apdex_satisfied= din.readDecimal();
|
|
213
|
+
m.apdex_tolerated= din.readDecimal();
|
|
214
|
+
|
|
215
|
+
if(ver <=3) return m;
|
|
216
|
+
m.time_min= din.readDecimal();
|
|
217
|
+
m.time_std= din.readDecimal();
|
|
218
|
+
*/
|
|
219
|
+
return m;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
TransactionRec.writeRec = function( o, m ) {
|
|
223
|
+
let ver = 2;
|
|
224
|
+
o.writeInt(m.hash);
|
|
225
|
+
o.writeByte(ver); //0,1 = old version
|
|
226
|
+
o.writeDecimal(m.count);
|
|
227
|
+
o.writeDecimal(m.error);
|
|
228
|
+
o.writeDecimal(m.time_sum);
|
|
229
|
+
o.writeDecimal(m.time_max);
|
|
230
|
+
o.writeDecimal(m.sql_count);
|
|
231
|
+
o.writeDecimal(m.sql_time);
|
|
232
|
+
o.writeDecimal(m.sql_fetch);
|
|
233
|
+
o.writeDecimal(m.sql_fetch_time);
|
|
234
|
+
|
|
235
|
+
o.writeDecimal(m.httpc_count);
|
|
236
|
+
o.writeDecimal(m.httpc_time);
|
|
237
|
+
o.writeDecimal(m.malloc_sum);
|
|
238
|
+
o.writeDecimal(m.cpu_sum);
|
|
239
|
+
|
|
240
|
+
if (m.sqlMap == null) {
|
|
241
|
+
o.writeDecimal(0);
|
|
242
|
+
} else {
|
|
243
|
+
o.writeDecimal(m.sqlMap.size());
|
|
244
|
+
var en = m.sqlMap.entries(); // IntKeyEntry
|
|
245
|
+
while (en.hasMoreElements()) {
|
|
246
|
+
var ent = en.nextElement(); // TimeCount
|
|
247
|
+
o.writeInt(ent.getKey());
|
|
248
|
+
ent.getValue().write(o);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (m.httpcMap == null) {
|
|
252
|
+
o.writeDecimal(0);
|
|
253
|
+
} else {
|
|
254
|
+
o.writeDecimal(m.httpcMap.size());
|
|
255
|
+
var en = m.httpcMap.entries(); // IntKeyEntry
|
|
256
|
+
while (en.hasMoreElements()) {
|
|
257
|
+
var ent = en.nextElement(); // TimeCount
|
|
258
|
+
o.writeInt(ent.getKey());
|
|
259
|
+
ent.getValue().write(o);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/*
|
|
263
|
+
if(ver <=2) return;
|
|
264
|
+
o.writeDecimal(m.apdex_satisfied);
|
|
265
|
+
o.writeDecimal(m.apdex_tolerated);
|
|
266
|
+
|
|
267
|
+
if(ver <=3) return;
|
|
268
|
+
o.writeDecimal(m.time_min);
|
|
269
|
+
o.writeDecimal(m.time_std);
|
|
270
|
+
*/
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
TransactionRec.createMap = function(cnt) {
|
|
274
|
+
var m = new IntKeyMap(cnt);
|
|
275
|
+
m.create = function(key){
|
|
276
|
+
return this.size() >= 1000 ? null : new TimeCount();
|
|
277
|
+
}
|
|
278
|
+
return m;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function _drop(din){
|
|
282
|
+
var c = din.readDecNumber();
|
|
283
|
+
if (c > 0) {
|
|
284
|
+
for (i = 0; i < c; i++) {
|
|
285
|
+
din.readInt();
|
|
286
|
+
din.readDecNumber();
|
|
287
|
+
din.readDecNumber();
|
|
288
|
+
din.readDecNumber();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
module.exports = TransactionRec;
|
|
@@ -0,0 +1,151 @@
|
|
|
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 Pack = require('./pack'),
|
|
8
|
+
PackEnum = require('./packenum'),
|
|
9
|
+
IntKeyLinkedMap = require('../util/intkey-linkedmap'),
|
|
10
|
+
DataOutputX = require('../io/data-outputx'),
|
|
11
|
+
DataInputX = require('../io/data-inputx'),
|
|
12
|
+
TimeCount = require('./time-count');
|
|
13
|
+
|
|
14
|
+
function TransactionRecDep() {
|
|
15
|
+
this.hash = 0; /*int*/
|
|
16
|
+
|
|
17
|
+
this.count = 0; /*int*/
|
|
18
|
+
this.error = 0; /*int*/
|
|
19
|
+
|
|
20
|
+
this.time_sum = 0; /*long*/
|
|
21
|
+
this.time_max = 0; /*int*/
|
|
22
|
+
|
|
23
|
+
this.sql_count = 0; /*int*/
|
|
24
|
+
this.sql_time = 0; /*long*/
|
|
25
|
+
this.sql_fetch = 0; /*int*/
|
|
26
|
+
this.sql_fetch_time = 0; /*long*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
this.httpc_count = 0; /*int*/
|
|
31
|
+
this.httpc_time = 0; /*long*/
|
|
32
|
+
this.malloc_sum = 0; /*long*/
|
|
33
|
+
this.cpu_sum = 0; /*long*/
|
|
34
|
+
|
|
35
|
+
/*임시변수 서버전송 안함*/ this.profiled = false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
TransactionRecDep.prototype.mergeForStat = function(o){
|
|
39
|
+
this.count += o.count;
|
|
40
|
+
this.error += o.error;
|
|
41
|
+
|
|
42
|
+
this.time_sum +=o.time_sum;
|
|
43
|
+
this.time_max = Math.max(this.time_max, o.time_max);
|
|
44
|
+
|
|
45
|
+
this.sql_count += o.sql_count;
|
|
46
|
+
this.sql_time +=o.sql_time;
|
|
47
|
+
this.sql_fetch += o.sql_fetch;
|
|
48
|
+
this.sql_fetch_time +=o.sql_fetch_time;
|
|
49
|
+
|
|
50
|
+
this.httpc_count += o.httpc_count;
|
|
51
|
+
this.httpc_time +=o.httpc_time;
|
|
52
|
+
|
|
53
|
+
this.malloc_sum +=o.malloc_sum;
|
|
54
|
+
this.cpu_sum +=o.cpu_sum;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
TransactionRecDep.prototype.merge = function(o) {
|
|
58
|
+
this.count += o.count;
|
|
59
|
+
this.error += o.error;
|
|
60
|
+
this.time_sum +=o.time_sum;
|
|
61
|
+
this.time_max = Math.max(this.time_max, o.time_max);
|
|
62
|
+
|
|
63
|
+
this.sql_count += o.sql_count;
|
|
64
|
+
this.sql_time +=o.sql_time;
|
|
65
|
+
|
|
66
|
+
this.sql_fetch += o.sql_fetch;
|
|
67
|
+
this.sql_fetch_time +=o.sql_fetch_time;
|
|
68
|
+
|
|
69
|
+
this.httpc_count += o.httpc_count;
|
|
70
|
+
this.httpc_time += o.httpc_time;
|
|
71
|
+
|
|
72
|
+
this.malloc_sum += o.malloc_sum;
|
|
73
|
+
this.cpu_sum += o.cpu_sum;
|
|
74
|
+
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
TransactionRecDep.prototype.setUrlHash = function(hash) {
|
|
78
|
+
this.hash = hash;
|
|
79
|
+
return this;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
TransactionRecDep.prototype.getDeviation = function() {
|
|
83
|
+
if (this.count === 0) {
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
var avg = this.time_suthis.divide(this.count); /*long*/
|
|
87
|
+
var variation = (this.time_std - (2 * avg * this.time_sum) + (this.count * avg * avg)) / this.count;
|
|
88
|
+
|
|
89
|
+
// NAN check..
|
|
90
|
+
var ret = Math.sqrt(variation);
|
|
91
|
+
return isNaN(ret) ? 0 : ret;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
TransactionRecDep.prototype.write = function(dout) {
|
|
96
|
+
dout.writeInt(this.hash);
|
|
97
|
+
dout.writeByte(2);
|
|
98
|
+
dout.writeDecimal(this.count);
|
|
99
|
+
dout.writeDecimal(this.error);
|
|
100
|
+
dout.writeDecimal(this.time_sum);
|
|
101
|
+
dout.writeDecimal(this.time_max);
|
|
102
|
+
|
|
103
|
+
dout.writeDecimal(this.sql_count);
|
|
104
|
+
dout.writeDecimal(this.sql_time);
|
|
105
|
+
dout.writeDecimal(this.sql_fetch);
|
|
106
|
+
dout.writeDecimal(this.sql_fetch_time);
|
|
107
|
+
|
|
108
|
+
dout.writeDecimal(this.httpc_count);
|
|
109
|
+
dout.writeDecimal(this.httpc_time);
|
|
110
|
+
dout.writeDecimal(this.malloc_sum);
|
|
111
|
+
dout.writeDecimal(this.cpu_sum);
|
|
112
|
+
|
|
113
|
+
dout.writeDecimal(0);
|
|
114
|
+
dout.writeDecimal(0);
|
|
115
|
+
};
|
|
116
|
+
TransactionRecDep.prototype.read = function(din) {
|
|
117
|
+
this.hash = din.readInt();
|
|
118
|
+
var ver = din.readByte();
|
|
119
|
+
this.count = din.readDecNumber();
|
|
120
|
+
this.error = din.readDecNumber();
|
|
121
|
+
this.time_sum = din.readDecNumber();
|
|
122
|
+
this.time_max = din.readDecNumber();
|
|
123
|
+
|
|
124
|
+
this.sql_count = din.readDecNumber();
|
|
125
|
+
this.sql_time = din.readDecNumber();
|
|
126
|
+
this.sql_fetch = din.readDecNumber();
|
|
127
|
+
this.sql_fetch_time = din.readDecNumber();
|
|
128
|
+
|
|
129
|
+
this.httpc_count = din.readDecNumber();
|
|
130
|
+
this.httpc_time = din.readDecNumber();
|
|
131
|
+
this.malloc_sum = din.readDecNumber();
|
|
132
|
+
this.cpu_sum = din.readDecNumber();
|
|
133
|
+
|
|
134
|
+
_drop(din);
|
|
135
|
+
_drop(din);
|
|
136
|
+
|
|
137
|
+
return this;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
function _drop(din){
|
|
141
|
+
var c = din.readDecNumber();
|
|
142
|
+
if (c > 0) {
|
|
143
|
+
for (i = 0; i < c; i++) {
|
|
144
|
+
din.readInt();
|
|
145
|
+
din.readDecNumber();
|
|
146
|
+
din.readDecNumber();
|
|
147
|
+
din.readDecNumber();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
module.exports = TransactionRecDep;
|
|
@@ -0,0 +1,69 @@
|
|
|
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 Pack = require('./pack'),
|
|
8
|
+
PackEnum = require('./packenum'),
|
|
9
|
+
DataOutputX = require('../io/data-outputx'),
|
|
10
|
+
DataInputX = require('../io/data-inputx'),
|
|
11
|
+
SqlRec = require('./statsql-rec');
|
|
12
|
+
|
|
13
|
+
function StatSqlPack() {
|
|
14
|
+
Pack.call(this);
|
|
15
|
+
this.records = [];
|
|
16
|
+
this.record_count = 0;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
StatSqlPack.prototype = new Pack();
|
|
21
|
+
StatSqlPack.prototype.constructor = StatSqlPack;
|
|
22
|
+
StatSqlPack.prototype.getPackType = function () {
|
|
23
|
+
return PackEnum.STAT_SQL;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
StatSqlPack.prototype.write = function (dout) {
|
|
27
|
+
Pack.prototype.write.call(this, dout);
|
|
28
|
+
dout.writeBlob(this.records);
|
|
29
|
+
dout.writeDecimal(this.record_count);
|
|
30
|
+
};
|
|
31
|
+
StatSqlPack.prototype.read = function (din) {
|
|
32
|
+
Pack.prototype.read.call(this, din);
|
|
33
|
+
this.records = din.readBlob();
|
|
34
|
+
this.record_count = din.readDecNumber();
|
|
35
|
+
return this;
|
|
36
|
+
};
|
|
37
|
+
StatSqlPack.prototype.setRecords = function (size, items) {
|
|
38
|
+
var dout = new DataOutputX();
|
|
39
|
+
dout.writeShort(size);
|
|
40
|
+
while(items.hasMoreElements()) {
|
|
41
|
+
SqlRec.writeRec(dout, items.nextElement());
|
|
42
|
+
//items.nextElement().write(dout);
|
|
43
|
+
}
|
|
44
|
+
/*
|
|
45
|
+
for(var i=0; i<size; i++) {
|
|
46
|
+
items.nextElement().write(dout);
|
|
47
|
+
}
|
|
48
|
+
*/
|
|
49
|
+
this.records = dout.toByteArray();
|
|
50
|
+
this.record_count = size;
|
|
51
|
+
return this;
|
|
52
|
+
};
|
|
53
|
+
StatSqlPack.prototype.getRecords = function () {
|
|
54
|
+
var items = [];
|
|
55
|
+
if(this.records == null) {
|
|
56
|
+
return items;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
var din = new DataInputX(this.records);
|
|
60
|
+
var size = din.readShort();
|
|
61
|
+
for(var i=0; i<size; i++) {
|
|
62
|
+
var m = new SqlRec().read(din);
|
|
63
|
+
items.push(m);
|
|
64
|
+
}
|
|
65
|
+
return items;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
module.exports = StatSqlPack;
|
|
@@ -0,0 +1,100 @@
|
|
|
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 BitUtil = require('../util/bitutil');
|
|
8
|
+
|
|
9
|
+
function SqlRec() {
|
|
10
|
+
this.dbc = 0;
|
|
11
|
+
this.sql = 0;
|
|
12
|
+
this.sql_crud = 0;
|
|
13
|
+
this.count_total = 0;
|
|
14
|
+
this.count_error = 0;
|
|
15
|
+
//this.count_actived = 0;
|
|
16
|
+
this.time_sum = 0;
|
|
17
|
+
this.time_std = 0;
|
|
18
|
+
this.time_min = 0;
|
|
19
|
+
this.time_max = 0;
|
|
20
|
+
this.fetch_count = 0;
|
|
21
|
+
this.fetch_time = 0;
|
|
22
|
+
this.update_count = 0;
|
|
23
|
+
this.service = 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
SqlRec.prototype.merge = function (other) {
|
|
27
|
+
this.count_total += other.count_total;
|
|
28
|
+
this.count_error += other.count_error;
|
|
29
|
+
//this.count_actived += other.count_actived;
|
|
30
|
+
this.time_sum +=other.time_sum;
|
|
31
|
+
this.time_std = other.time_std;
|
|
32
|
+
this.time_max = Math.max(this.time_max, other.time_max);
|
|
33
|
+
this.time_min = Math.min(this.time_min, other.time_min);
|
|
34
|
+
this.fetch_count += other.fetch_count;
|
|
35
|
+
this.fetch_time += other.fetch_time;
|
|
36
|
+
this.update_count +=other.update_count;
|
|
37
|
+
};
|
|
38
|
+
SqlRec.prototype.key = function () {
|
|
39
|
+
return BitUtil.composite(this.dbc, this.sql);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
SqlRec.prototype.write = function (dout, m) {
|
|
43
|
+
dout.writeInt(this.dbc);
|
|
44
|
+
dout.writeInt(this.sql);
|
|
45
|
+
dout.writeByte(this.sql_crud);
|
|
46
|
+
dout.writeDecimal(this.count_total);
|
|
47
|
+
dout.writeDecimal(this.count_error);
|
|
48
|
+
dout.writeDecimal(-1);
|
|
49
|
+
dout.writeDecimal(this.time_sum);
|
|
50
|
+
dout.writeDecimal(this.time_std);
|
|
51
|
+
dout.writeDecimal(this.time_min);
|
|
52
|
+
dout.writeDecimal(this.time_max);
|
|
53
|
+
dout.writeDecimal(this.fetch_count);
|
|
54
|
+
dout.writeDecimal(this.fetch_time);
|
|
55
|
+
dout.writeDecimal(this.update_count);
|
|
56
|
+
|
|
57
|
+
dout.writeDecimal(this.service);
|
|
58
|
+
};
|
|
59
|
+
SqlRec.prototype.read = function (din) {
|
|
60
|
+
this.dbc = din.readInt();
|
|
61
|
+
this.sql = din.readInt();
|
|
62
|
+
this.sql_crud = din.readByte();
|
|
63
|
+
this.count_total = din.readDecNumber();
|
|
64
|
+
this.count_error = din.readDecNumber();
|
|
65
|
+
|
|
66
|
+
var ver = din.readDecNumber();
|
|
67
|
+
|
|
68
|
+
this.time_sum = din.readDecNumber();
|
|
69
|
+
this.time_std = din.readDecNumber();
|
|
70
|
+
this.time_min = din.readDecNumber();
|
|
71
|
+
this.time_max = din.readDecNumber();
|
|
72
|
+
this.fetch_count = din.readDecNumber();
|
|
73
|
+
this.fetch_time = din.readDecNumber();
|
|
74
|
+
this.update_count = din.readDecNumber();
|
|
75
|
+
if(ver >=0){
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
this.service = din.readDecNumber();
|
|
79
|
+
return this;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
SqlRec.writeRec = function (dout, m) {
|
|
83
|
+
dout.writeInt(m.dbc);
|
|
84
|
+
dout.writeInt(m.sql);
|
|
85
|
+
dout.writeByte(m.sql_crud);
|
|
86
|
+
dout.writeDecimal(m.count_total);
|
|
87
|
+
dout.writeDecimal(m.count_error);
|
|
88
|
+
dout.writeDecimal(-1);
|
|
89
|
+
dout.writeDecimal(m.time_sum);
|
|
90
|
+
dout.writeDecimal(m.time_std);
|
|
91
|
+
dout.writeDecimal(m.time_min);
|
|
92
|
+
dout.writeDecimal(m.time_max);
|
|
93
|
+
dout.writeDecimal(m.fetch_count);
|
|
94
|
+
dout.writeDecimal(m.fetch_time);
|
|
95
|
+
dout.writeDecimal(m.update_count);
|
|
96
|
+
|
|
97
|
+
dout.writeDecimal(m.service);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
module.exports = SqlRec;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 Pack = require('./pack'),
|
|
8
|
+
PackEnum = require('./packenum'),
|
|
9
|
+
IntIntMap = require('../util/intint-map');
|
|
10
|
+
|
|
11
|
+
function StatUserAgentPack() {
|
|
12
|
+
Pack.call(this);
|
|
13
|
+
this.userAgents = new IntIntMap();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
StatUserAgentPack.prototype = new Pack();
|
|
17
|
+
StatUserAgentPack.prototype.constructor = StatUserAgentPack;
|
|
18
|
+
StatUserAgentPack.prototype.getPackType = function () {
|
|
19
|
+
return PackEnum.STAT_USER_AGENT;
|
|
20
|
+
};
|
|
21
|
+
StatUserAgentPack.prototype.write = function (dout) {
|
|
22
|
+
Pack.prototype.write.call(this, dout);
|
|
23
|
+
|
|
24
|
+
dout.writeDecimal(this.userAgents.size());
|
|
25
|
+
var en = this.userAgents.entries();
|
|
26
|
+
while(en.hasMoreElements()) {
|
|
27
|
+
var e = en.nextElement();
|
|
28
|
+
dout.writeInt(e.getKey());
|
|
29
|
+
dout.writeInt(e.getValue());
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
StatUserAgentPack.prototype.read = function (din) {
|
|
33
|
+
Pack.prototype.read.call(this, din);
|
|
34
|
+
var cnt = din.readDecNumber();
|
|
35
|
+
this.userAgents = new IntIntMap();
|
|
36
|
+
for(var i=0; i<cnt; i++) {
|
|
37
|
+
var ip = din.readInt();
|
|
38
|
+
var count = din.readInt();
|
|
39
|
+
this.userAgents.put(ip, count);
|
|
40
|
+
}
|
|
41
|
+
return this;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
module.exports = StatUserAgentPack;
|
|
@@ -21,10 +21,10 @@ function TagCountPack() {
|
|
|
21
21
|
this.originOid = null;
|
|
22
22
|
this.tags = new MapValue()
|
|
23
23
|
this.fields = new MapValue()
|
|
24
|
-
this.read_size
|
|
25
|
-
this.fieldPos
|
|
26
|
-
this.tagPos
|
|
27
|
-
this.madeByPlugIn
|
|
24
|
+
this.read_size
|
|
25
|
+
this.fieldPos
|
|
26
|
+
this.tagPos
|
|
27
|
+
this.madeByPlugIn
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
TagCountPack.prototype = new Pack();
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
function TagCtr() {
|
|
8
|
+
this.cache_last_only = "_cache_last_only_"
|
|
9
|
+
this.no_cache = "_no_cache_"
|
|
10
|
+
this.no_5m_hour = "_no_5m_hour_"
|
|
11
|
+
this.agency = "agency"
|
|
12
|
+
this.taglog = "taglog"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
module.exports = TagCtr;
|