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,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 PackEnum = require('./packenum'),
|
|
8
|
+
Pack = require('./pack'),
|
|
9
|
+
Step = require('../step/step'),
|
|
10
|
+
DataOutputX = require('../io/data-outputx'),
|
|
11
|
+
Long = require('long');
|
|
12
|
+
|
|
13
|
+
function ErrorSnapPack1() {
|
|
14
|
+
Pack.call(this);
|
|
15
|
+
this.seq = Long.ZERO;
|
|
16
|
+
this.profile = null;
|
|
17
|
+
this.stack = null;
|
|
18
|
+
this.append_type = 0;
|
|
19
|
+
this.append_hash = 0;
|
|
20
|
+
this.setProfile = function(steps){
|
|
21
|
+
this.profile = Step.toBytes(steps);
|
|
22
|
+
return this;
|
|
23
|
+
};
|
|
24
|
+
this.setStack = function(callstacks) {
|
|
25
|
+
this.stack = new DataOutputX().writeIntArray(callstacks).toByteArray();
|
|
26
|
+
return this;
|
|
27
|
+
};
|
|
28
|
+
this.getProfile = function() {
|
|
29
|
+
return Step.toObjects(this.stack);
|
|
30
|
+
};
|
|
31
|
+
this.getStack = function() {
|
|
32
|
+
if( this.stack == null || this.stack.length === 0 ) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return this.stack;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
ErrorSnapPack1.prototype = new Pack();
|
|
40
|
+
ErrorSnapPack1.prototype.constructor = ErrorSnapPack1;
|
|
41
|
+
ErrorSnapPack1.prototype.toString = function() {
|
|
42
|
+
return "ErrorSnap " + Pack.prototype.toString.call(this)
|
|
43
|
+
+ ", profile_bytes="
|
|
44
|
+
+ ((this.profile != null) ? this.profile.length : 0)
|
|
45
|
+
+ " stack_bytes="
|
|
46
|
+
+ ((this.stack != null) ? this.stack.length : 0);
|
|
47
|
+
};
|
|
48
|
+
ErrorSnapPack1.prototype.getPackType = function () {
|
|
49
|
+
return PackEnum.ERROR_SNAP_1;
|
|
50
|
+
};
|
|
51
|
+
ErrorSnapPack1.prototype.write = function(dout) {
|
|
52
|
+
Pack.prototype.write.call(this, dout);
|
|
53
|
+
dout.writeLong(this.seq);
|
|
54
|
+
dout.writeBlob(this.profile);
|
|
55
|
+
dout.writeBlob(this.stack);
|
|
56
|
+
dout.writeByte(this.append_type);
|
|
57
|
+
dout.writeDecimal(this.append_hash);
|
|
58
|
+
};
|
|
59
|
+
ErrorSnapPack1.prototype.read = function(din) {
|
|
60
|
+
Pack.prototype.read.call(this, din);
|
|
61
|
+
this.seq = din.readLong();
|
|
62
|
+
this.profile = din.readBlob();
|
|
63
|
+
this.stack = din.readBlob();
|
|
64
|
+
this.append_type = din.readByte();
|
|
65
|
+
this.append_hash = din.readDecNumber();
|
|
66
|
+
return this;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
module.exports = ErrorSnapPack1;
|
|
@@ -0,0 +1,54 @@
|
|
|
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 PackEnum = require('./packenum'),
|
|
8
|
+
Pack = require('./pack');
|
|
9
|
+
|
|
10
|
+
function EventPack() {
|
|
11
|
+
Pack.call(this);
|
|
12
|
+
this.level = 0;
|
|
13
|
+
this.title = '';
|
|
14
|
+
this.message = '';
|
|
15
|
+
this.attr = {};
|
|
16
|
+
}
|
|
17
|
+
EventPack.prototype = new Pack();
|
|
18
|
+
EventPack.prototype.constructor = EventPack;
|
|
19
|
+
EventPack.prototype.getPackType = function() {
|
|
20
|
+
return PackEnum.EVENT;
|
|
21
|
+
};
|
|
22
|
+
EventPack.prototype.write = function(dout) {
|
|
23
|
+
Pack.prototype.write.call(this, dout);
|
|
24
|
+
|
|
25
|
+
dout.writeByte(this.level);
|
|
26
|
+
dout.writeText(this.title);
|
|
27
|
+
dout.writeText(this.message);
|
|
28
|
+
dout.writeByte(Object.keys(this.attr).length);
|
|
29
|
+
|
|
30
|
+
for(var key in this.attr) {
|
|
31
|
+
dout.writeText(key);
|
|
32
|
+
dout.writeText(this.attr[key]);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
EventPack.prototype.read = function(din) {
|
|
36
|
+
Pack.prototype.read.call(this, din);
|
|
37
|
+
|
|
38
|
+
this.level = din.readByte();
|
|
39
|
+
this.title = din.readText();
|
|
40
|
+
this.message = din.readText();
|
|
41
|
+
|
|
42
|
+
var keySize = din.readByte(),
|
|
43
|
+
key, value;
|
|
44
|
+
|
|
45
|
+
for(var i=0; i<keySize; i++) {
|
|
46
|
+
key = din.readText();
|
|
47
|
+
value = din.readText();
|
|
48
|
+
this.attr[key] = value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return this;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
module.exports = EventPack;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 PackEnum = require('./packenum'),
|
|
8
|
+
Pack = require('./pack');
|
|
9
|
+
|
|
10
|
+
function HitMapPack() {
|
|
11
|
+
this.hitCount = 0;
|
|
12
|
+
this.errorCount = 0;
|
|
13
|
+
this.hit = [];
|
|
14
|
+
this.error = [];
|
|
15
|
+
this.time90pct = 0;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
HitMapPack.prototype.getPackType = function() {
|
|
19
|
+
return PackEnum.HITMAP;
|
|
20
|
+
};
|
|
21
|
+
HitMapPack.prototype.write = function(dout) {
|
|
22
|
+
|
|
23
|
+
Pack.prototype.write.call(this, dout);
|
|
24
|
+
dout.writeDecimal(this.hitCount);
|
|
25
|
+
dout.writeDecimal(this.errorCount);
|
|
26
|
+
dout.writeDecimal(this.time90pct);
|
|
27
|
+
this.writeIntArray(dout, this.hit);
|
|
28
|
+
this.writeIntArray(dout, this.error);
|
|
29
|
+
};
|
|
30
|
+
HitMapPack.prototype.read = function(din) {
|
|
31
|
+
|
|
32
|
+
Pack.prototype.read.call(this, din);
|
|
33
|
+
this.hitCount = din.readDecLong();
|
|
34
|
+
this.errorCount = din.readDecLong();
|
|
35
|
+
this.time90pct = din.readDecNumber();
|
|
36
|
+
this.readIntArray(din, this.hit);
|
|
37
|
+
this.readIntArray(din, this.error);
|
|
38
|
+
|
|
39
|
+
return this;
|
|
40
|
+
};
|
|
41
|
+
HitMapPack.prototype.writeIntArray = function(dout, v){
|
|
42
|
+
|
|
43
|
+
if(v == null) {
|
|
44
|
+
dout.writeByte(0);
|
|
45
|
+
} else {
|
|
46
|
+
dout.writeByte(v.length);
|
|
47
|
+
for(var val in v) {
|
|
48
|
+
dout.writeDecimal(val);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
HitMapPack.prototype.readIntArray = function(din, map) {
|
|
53
|
+
var len = din.readByte();
|
|
54
|
+
for(var i=0; i<len; i++) {
|
|
55
|
+
if(i < map.length) {
|
|
56
|
+
map[i] = din.readDecNumber();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.Instance = HitMapPack;
|
|
62
|
+
exports.PCT_BOX = 50;
|
|
63
|
+
exports.HIT_MAP = 51;
|
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
Logger = require('../logger');
|
|
10
|
+
|
|
11
|
+
function HitMapPack1() {
|
|
12
|
+
Pack.call(this);
|
|
13
|
+
this.hit = new Array(HitMapPack1.LENGTH);
|
|
14
|
+
this.error = new Array(HitMapPack1.LENGTH);
|
|
15
|
+
|
|
16
|
+
this.hit.fill(0);
|
|
17
|
+
this.error.fill(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
HitMapPack1.LENGTH = 120;
|
|
21
|
+
HitMapPack1.prototype = new Pack();
|
|
22
|
+
HitMapPack1.prototype.constructor = HitMapPack1;
|
|
23
|
+
HitMapPack1.prototype.getPackType = function () {
|
|
24
|
+
return PackEnum.HITMAP_1;
|
|
25
|
+
};
|
|
26
|
+
HitMapPack1.prototype.write = function (dout) {
|
|
27
|
+
Pack.prototype.write.call(this, dout);
|
|
28
|
+
// dout.writeByte(1);
|
|
29
|
+
// for(var i=0; i<HitMapPack1.LENGTH; i++) {
|
|
30
|
+
// dout.writeShort(this.hit[i]);
|
|
31
|
+
// dout.writeShort(this.error[i]);
|
|
32
|
+
// }
|
|
33
|
+
dout.writeByte(3);// version
|
|
34
|
+
writeArr(dout, this.hit);
|
|
35
|
+
writeArr(dout, this.error);
|
|
36
|
+
};
|
|
37
|
+
HitMapPack1.prototype.read = function (din) {
|
|
38
|
+
Pack.prototype.read.call(this, din);
|
|
39
|
+
var ver = din.readByte();
|
|
40
|
+
|
|
41
|
+
if(ver === 1) {
|
|
42
|
+
for(var i=0; i<HitMapPack1.LENGTH; i++) {
|
|
43
|
+
this.hit[i] = din.readShort() & 0xffff;
|
|
44
|
+
this.error[i] = din.readShort() & 0xffff;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if(ver === 3){
|
|
48
|
+
readArr(din, this.hit);
|
|
49
|
+
readArr(din, this.error);
|
|
50
|
+
}
|
|
51
|
+
return this;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
function writeArr( dout, arr) {
|
|
55
|
+
try{
|
|
56
|
+
if (arr == null) {
|
|
57
|
+
dout.writeByte(0);
|
|
58
|
+
} else {
|
|
59
|
+
var len = HitMapPack1.LENGTH - 1;
|
|
60
|
+
for (; len >= 0; len--) {
|
|
61
|
+
if (arr[len] != 0)
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
len = len + 1;
|
|
65
|
+
dout.writeByte(len);
|
|
66
|
+
for (var i = 0; i < len; i++) {
|
|
67
|
+
dout.writeUInt16BE(arr[i]);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}catch (e) {
|
|
71
|
+
Logger.printError('WHATAP-088', 'Hit-map pack - write error', e, false);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function readArr( din, arr) {
|
|
76
|
+
var len = din.readByte() & 0xff;
|
|
77
|
+
for (var i = 0; i < len; i++) {
|
|
78
|
+
arr[i] = din.readShort() & 0xffff;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
HitMapPack1.prototype.copy = function () {
|
|
82
|
+
var newOne = new HitMapPack1();
|
|
83
|
+
newOne.pcode = this.pcode;
|
|
84
|
+
newOne.oid = this.oid;
|
|
85
|
+
newOne.time = this.time;
|
|
86
|
+
|
|
87
|
+
newOne.hit = this.hit.slice();
|
|
88
|
+
newOne.error = this.error.slice();
|
|
89
|
+
return newOne;
|
|
90
|
+
};
|
|
91
|
+
HitMapPack1.prototype.merge = function (p) {
|
|
92
|
+
for(var i=0; i<this.LENGTH; i++) {
|
|
93
|
+
this.hit[i] += p.hit[i];
|
|
94
|
+
this.error[i] += p.error[i];
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
HitMapPack1.prototype.add = function (time, isError) {
|
|
98
|
+
var idx = HitMapPack1.index(time);
|
|
99
|
+
this.hit[idx]++;
|
|
100
|
+
if(isError) {
|
|
101
|
+
this.error[idx]++;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
HitMapPack1.prototype.toString = function() {
|
|
105
|
+
return 'HitMap1 ' + Pack.prototype.toString.call(this) + ', hit=' + this.hit.length + ", error=" + this.error.length;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
HitMapPack1.index = function (time) {
|
|
109
|
+
var x = parseInt(time / 10000);
|
|
110
|
+
switch (x) {
|
|
111
|
+
case 0:
|
|
112
|
+
if (time < 5000)
|
|
113
|
+
return parseInt(time / 125);
|
|
114
|
+
else
|
|
115
|
+
return 40 + parseInt((time - 5000) / 250);
|
|
116
|
+
case 1:
|
|
117
|
+
return 60 + parseInt((time - 10000) / 500);
|
|
118
|
+
case 2:
|
|
119
|
+
case 3:
|
|
120
|
+
return 80 + parseInt((time - 20000) / 1000);
|
|
121
|
+
case 4:
|
|
122
|
+
case 5:
|
|
123
|
+
case 6:
|
|
124
|
+
case 7:
|
|
125
|
+
return 100 + parseInt((time - 40000) / 2000);
|
|
126
|
+
default:
|
|
127
|
+
return 119;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
HitMapPack1.time = function(index) {
|
|
131
|
+
var _time = 0;
|
|
132
|
+
if (index < 40)
|
|
133
|
+
return index * 125;
|
|
134
|
+
_time = 5000;
|
|
135
|
+
if (index < 60)
|
|
136
|
+
return _time + (index - 40) * 250;
|
|
137
|
+
_time = 10000;
|
|
138
|
+
if (index < 80)
|
|
139
|
+
return _time + (index - 60) * 500;
|
|
140
|
+
|
|
141
|
+
_time = 20000;
|
|
142
|
+
if (index < 100)
|
|
143
|
+
return _time + (index - 80) * 1000;
|
|
144
|
+
|
|
145
|
+
_time = 40000;
|
|
146
|
+
if (index < 120)
|
|
147
|
+
return _time + (index - 100) * 2000;
|
|
148
|
+
return 80000;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
module.exports = HitMapPack1;
|
|
@@ -4,17 +4,18 @@ const MapValue = require('../value/map-value');
|
|
|
4
4
|
const DataOutputX = require('../io/data-outputx');
|
|
5
5
|
const DataInputX = require('../io/data-inputx');
|
|
6
6
|
const HashUtil = require('../util/hashutil');
|
|
7
|
+
const Value = require('../value/value');
|
|
7
8
|
const BooleanValue = require('../value/boolean-value');
|
|
8
9
|
|
|
9
10
|
function LogSinkPack() {
|
|
10
11
|
Pack.call(this);
|
|
11
|
-
this.
|
|
12
|
-
this.time = null;
|
|
12
|
+
this.category = '';
|
|
13
13
|
this.tagHash = 0;
|
|
14
14
|
this.tags = new MapValue();
|
|
15
15
|
this.line = 0;
|
|
16
16
|
this.content = '';
|
|
17
17
|
this.fields = new MapValue();
|
|
18
|
+
this.dropped = false;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
LogSinkPack.prototype = Object.create(Pack.prototype);
|
|
@@ -25,7 +26,7 @@ LogSinkPack.prototype.getPackType = function () {
|
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
LogSinkPack.prototype.toString = function () {
|
|
28
|
-
return `${Pack.prototype.toString.call(this)} [category=${this.
|
|
29
|
+
return `${Pack.prototype.toString.call(this)} [category=${this.category}, tagHash=${this.tagHash}, tags=${this.tags}, content=${this.content}, fields=${this.fields}]`;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
LogSinkPack.prototype.getTagAsBytes = function () {
|
|
@@ -84,24 +85,13 @@ LogSinkPack.prototype.setContentBytes = function (d) {
|
|
|
84
85
|
|
|
85
86
|
LogSinkPack.prototype.write = function (dout) {
|
|
86
87
|
Pack.prototype.write.call(this, dout);
|
|
87
|
-
|
|
88
88
|
dout.writeByte(0);
|
|
89
|
-
dout.writeText(this.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const result = this.resetTagHash();
|
|
93
|
-
this.tagHash = result.tagHash;
|
|
94
|
-
dout.writeDecimal(result.tagHash);
|
|
95
|
-
dout.write(result.tagBytes);
|
|
96
|
-
} else {
|
|
97
|
-
dout.writeDecimal(this.tagHash);
|
|
98
|
-
dout.writeValue(this.tags);
|
|
99
|
-
}
|
|
100
|
-
|
|
89
|
+
dout.writeText(this.category);
|
|
90
|
+
dout.writeDecimal(this.tagHash);
|
|
91
|
+
dout.writeValue(this.tags);
|
|
101
92
|
dout.writeDecimal(this.line);
|
|
102
93
|
dout.writeText(this.content);
|
|
103
|
-
|
|
104
|
-
if (this.fields && this.fields.size() > 0) {
|
|
94
|
+
if (this.fields.size() > 0) {
|
|
105
95
|
dout.writeBoolean(true);
|
|
106
96
|
dout.writeValue(this.fields);
|
|
107
97
|
} else {
|
|
@@ -112,7 +102,7 @@ LogSinkPack.prototype.write = function (dout) {
|
|
|
112
102
|
LogSinkPack.prototype.read = function (din) {
|
|
113
103
|
Pack.prototype.read.call(this, din);
|
|
114
104
|
const ver = din.readByte();
|
|
115
|
-
this.
|
|
105
|
+
this.category = din.readText();
|
|
116
106
|
this.tagHash = din.readDecimal();
|
|
117
107
|
this.tags = din.readValue();
|
|
118
108
|
this.line = din.readDecimal();
|
|
@@ -124,11 +114,11 @@ LogSinkPack.prototype.read = function (din) {
|
|
|
124
114
|
};
|
|
125
115
|
|
|
126
116
|
LogSinkPack.prototype.resetTagHash = function () {
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
const tagBytes =
|
|
130
|
-
|
|
131
|
-
return
|
|
117
|
+
const out = new DataOutputX();
|
|
118
|
+
out.writeValue(this.tags);
|
|
119
|
+
const tagBytes = out.toByteArray();
|
|
120
|
+
this.tagHash = HashUtil.hash64(tagBytes);
|
|
121
|
+
return tagBytes;
|
|
132
122
|
};
|
|
133
123
|
|
|
134
124
|
LogSinkPack.prototype.transferOidToTag = function () {
|
|
@@ -146,32 +136,4 @@ LogSinkPack.prototype.transferOidToTag = function () {
|
|
|
146
136
|
}
|
|
147
137
|
};
|
|
148
138
|
|
|
149
|
-
LogSinkPack.getLogSinkPack = function(options) {
|
|
150
|
-
const {
|
|
151
|
-
t = 0,
|
|
152
|
-
category = null,
|
|
153
|
-
tags = {},
|
|
154
|
-
fields = {},
|
|
155
|
-
line = 0,
|
|
156
|
-
content = null
|
|
157
|
-
} = options || {};
|
|
158
|
-
|
|
159
|
-
const pack = new LogSinkPack();
|
|
160
|
-
pack.time = t;
|
|
161
|
-
pack.Category = category;
|
|
162
|
-
|
|
163
|
-
for (const [k, v] of Object.entries(tags)) {
|
|
164
|
-
pack.tags.putString(k, String(v));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
for (const [k, v] of Object.entries(fields)) {
|
|
168
|
-
pack.fields.putString(k, String(v));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
pack.line = line;
|
|
172
|
-
pack.content = content;
|
|
173
|
-
|
|
174
|
-
return pack;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
139
|
module.exports = LogSinkPack;
|
|
@@ -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 NETSTAT(){
|
|
8
|
+
this.est = 0;
|
|
9
|
+
this.fin_w = 0;
|
|
10
|
+
this.tim_w = 0;
|
|
11
|
+
this.clo_w = 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
module.exports = NETSTAT;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 PackEnum = require('./packenum'),
|
|
8
|
+
Pack = require('./pack'),
|
|
9
|
+
TxRecord = require('../service/tx-record'),
|
|
10
|
+
Step = require('../step/step');
|
|
11
|
+
|
|
12
|
+
function ProfilePack() {
|
|
13
|
+
Pack.call(this);
|
|
14
|
+
this.service = null;
|
|
15
|
+
this.steps = null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
ProfilePack.prototype = new Pack();
|
|
19
|
+
ProfilePack.prototype.constructor = ProfilePack;
|
|
20
|
+
ProfilePack.prototype.toString = function() {
|
|
21
|
+
var text = 'Profile '
|
|
22
|
+
+ Pack.prototype.toString.call(this)
|
|
23
|
+
+ ', step_bytes='
|
|
24
|
+
+ ((this.steps != null) ? this.steps.length : 0);
|
|
25
|
+
if (this.service != null) {
|
|
26
|
+
text += " time=" + this.service.endTime + ", active=" + this.service.active;
|
|
27
|
+
}
|
|
28
|
+
return text;
|
|
29
|
+
};
|
|
30
|
+
ProfilePack.prototype.getPackType = function() {
|
|
31
|
+
return PackEnum.PROFILE;
|
|
32
|
+
};
|
|
33
|
+
ProfilePack.prototype.write = function(dout) {
|
|
34
|
+
Pack.prototype.write.call(this, dout);
|
|
35
|
+
this.service.write(dout);
|
|
36
|
+
dout.writeBlob(this.steps);
|
|
37
|
+
};
|
|
38
|
+
ProfilePack.prototype.read = function(din) {
|
|
39
|
+
Pack.prototype.read.call(this, din);
|
|
40
|
+
this.service = new TxRecord().read(din);
|
|
41
|
+
this.steps = din.readBlob();
|
|
42
|
+
return this;
|
|
43
|
+
};
|
|
44
|
+
ProfilePack.prototype.setProfile = function(steps) {
|
|
45
|
+
this.steps = Step.toBytes(steps);
|
|
46
|
+
return this;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
module.exports = ProfilePack;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 PackEnum = require('./packenum'),
|
|
8
|
+
Pack = require('./pack'),
|
|
9
|
+
DataOutputX = require('../io/data-outputx'),
|
|
10
|
+
DataInputX = require('../io/data-inputx');
|
|
11
|
+
|
|
12
|
+
function RealTimeUserPack(rType) {
|
|
13
|
+
this.cadinality;
|
|
14
|
+
Pack.call(this);
|
|
15
|
+
this.logbits = null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
RealTimeUserPack.prototype = new Pack();
|
|
19
|
+
RealTimeUserPack.prototype.constructor = RealTimeUserPack;
|
|
20
|
+
RealTimeUserPack.prototype.toString = function() {
|
|
21
|
+
return 'RealtimeUserPack '
|
|
22
|
+
+ Pack.prototype.toString.call(this)
|
|
23
|
+
+ ', logbits='
|
|
24
|
+
+ (this.logbits != null ? this.logbits.length : 0);
|
|
25
|
+
};
|
|
26
|
+
RealTimeUserPack.prototype.getPackType = function() {
|
|
27
|
+
return PackEnum.REALTIME_USER_1; //<-- 버전업함
|
|
28
|
+
};
|
|
29
|
+
RealTimeUserPack.prototype.write = function(dout) {
|
|
30
|
+
Pack.prototype.write.call(this, dout);
|
|
31
|
+
dout.writeBlob(this.logbits);
|
|
32
|
+
dout.writeDecimal(this.cadinality);
|
|
33
|
+
};
|
|
34
|
+
RealTimeUserPack.prototype.read = function(din) {
|
|
35
|
+
Pack.prototype.read.call(this, din);
|
|
36
|
+
this.logbits = din.readBlob();
|
|
37
|
+
this.cadinality= din.readDecNumber();
|
|
38
|
+
return this;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
module.exports = RealTimeUserPack;
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
AnyList = require('../util/anylist');
|
|
12
|
+
StringKeyLinkedMap = require('../util/stringkey-linkedmap');
|
|
13
|
+
|
|
14
|
+
function StatGeneralPack() {
|
|
15
|
+
Pack.call(this);
|
|
16
|
+
this.id = "";
|
|
17
|
+
this.data = new StringKeyLinkedMap();
|
|
18
|
+
this.dataBytes = null;
|
|
19
|
+
this.dataBytesSize = 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
StatGeneralPack.prototype = new Pack();
|
|
23
|
+
StatGeneralPack.prototype.constructor = StatGeneralPack;
|
|
24
|
+
StatGeneralPack.prototype.getPackType = function () {
|
|
25
|
+
return PackEnum.STAT_GENERAL;
|
|
26
|
+
};
|
|
27
|
+
StatGeneralPack.prototype.write = function (dout) {
|
|
28
|
+
Pack.prototype.write.call(this, dout);
|
|
29
|
+
|
|
30
|
+
dout.writeText(this.id);
|
|
31
|
+
if(this.dataBytes == null){
|
|
32
|
+
this.dataBytes = writeTable(this.data);
|
|
33
|
+
this.dataBytesSize = this.dataBytes.length;
|
|
34
|
+
}
|
|
35
|
+
dout.writeInt24BE(this.dataBytesSize);
|
|
36
|
+
dout.write(this.dataBytes);
|
|
37
|
+
};
|
|
38
|
+
function writeTable(data) {
|
|
39
|
+
var dd = new DataOutputX();
|
|
40
|
+
dd.writeShort(data.size());
|
|
41
|
+
var en = data.entries();
|
|
42
|
+
while (en.hasMoreElements()) {
|
|
43
|
+
var ent = en.nextElement();
|
|
44
|
+
dd.writeText(ent.getKey());
|
|
45
|
+
dd.writeByte(ent.getValue().getType()); // type
|
|
46
|
+
ent.getValue().write(dd); // data
|
|
47
|
+
}
|
|
48
|
+
return dd.toByteArray();
|
|
49
|
+
}
|
|
50
|
+
StatGeneralPack.prototype.read = function (din) {
|
|
51
|
+
Pack.prototype.read.call(this, din);
|
|
52
|
+
this.id = din.readText();
|
|
53
|
+
this.dataBytesSize = din.readInt24BE();
|
|
54
|
+
this.dataBytes = din.read(this.dataBytesSize);
|
|
55
|
+
return this;
|
|
56
|
+
};
|
|
57
|
+
function readTable( bytes, data) {
|
|
58
|
+
var din = new DataInputX(bytes);
|
|
59
|
+
var cnt = din.readShort();
|
|
60
|
+
for (var i = 0; i < cnt; i++) {
|
|
61
|
+
var key = din.readText();
|
|
62
|
+
var a = new AnyList(din.readByte());
|
|
63
|
+
a.read(din);
|
|
64
|
+
data.put(key, a);
|
|
65
|
+
}
|
|
66
|
+
return cnt;
|
|
67
|
+
}
|
|
68
|
+
StatGeneralPack.prototype.unpack = function() {
|
|
69
|
+
if (this.dataBytes != null) {
|
|
70
|
+
readTable(this.dataBytes, this.data);
|
|
71
|
+
this.dataBytes = null;
|
|
72
|
+
this.dataBytesSize = 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
StatGeneralPack.prototype.toString = function () {
|
|
77
|
+
var str = "StatGeneral ";
|
|
78
|
+
str += Pack.prototype.toString.call(this);
|
|
79
|
+
str += ", useragents=";
|
|
80
|
+
str += this.userAgents.size();
|
|
81
|
+
return str;
|
|
82
|
+
};
|
|
83
|
+
StatGeneralPack.prototype.put = function (key, data) {
|
|
84
|
+
this.data.put(key, data);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
StatGeneralPack.prototype.get = function (key) {
|
|
88
|
+
this.unpack();
|
|
89
|
+
return this.data.get(key);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
StatGeneralPack.prototype.isEmpty = function () {
|
|
93
|
+
return this.dataBytesSize == 0 && this.data.isEmpty();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
module.exports = StatGeneralPack;
|