whatap 0.5.26 → 1.0.0-canary.0

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.
Files changed (198) hide show
  1. package/README.md +78 -32
  2. package/agent/darwin/arm64/whatap_nodejs +0 -0
  3. package/agent/linux/amd64/whatap_nodejs +0 -0
  4. package/agent/linux/arm64/whatap_nodejs +0 -0
  5. package/build.txt +4 -0
  6. package/lib/conf/config-default.js +3 -10
  7. package/lib/conf/configure.js +349 -369
  8. package/lib/conf/license.js +1 -1
  9. package/lib/control/packagectr-helper.js +3 -34
  10. package/lib/core/agent.js +882 -176
  11. package/lib/core/interceptor.js +6 -6
  12. package/lib/core/shimmer.js +36 -82
  13. package/lib/counter/counter-manager.js +8 -79
  14. package/lib/counter/task/activetransaction.js +17 -68
  15. package/lib/io/data-inputx.js +3 -13
  16. package/lib/io/data-outputx.js +206 -268
  17. package/lib/logger.js +6 -6
  18. package/lib/net/security-master.js +20 -139
  19. package/lib/observers/apollo-server-observer.js +27 -33
  20. package/lib/observers/global-observer.js +80 -155
  21. package/lib/observers/http-observer.js +236 -666
  22. package/lib/observers/ioredis-observer.js +294 -0
  23. package/lib/observers/maria-observer.js +362 -204
  24. package/lib/observers/mongodb-observer.js +226 -169
  25. package/lib/observers/mongoose-observer.js +323 -518
  26. package/lib/observers/mssql-observer.js +418 -177
  27. package/lib/observers/mysql-observer.js +449 -342
  28. package/lib/observers/mysql2-observer.js +358 -396
  29. package/lib/observers/oracle-observer.js +384 -559
  30. package/lib/observers/pgsql-observer.js +489 -231
  31. package/lib/observers/prisma-observer.js +92 -303
  32. package/lib/observers/process-observer.js +35 -79
  33. package/lib/observers/redis-observer.js +331 -166
  34. package/lib/observers/socket.io-observer.js +187 -226
  35. package/lib/observers/websocket-observer.js +301 -175
  36. package/lib/pack/counter-pack.js +0 -3
  37. package/lib/pack/log-sink-pack.js +52 -14
  38. package/lib/pack/tagcount-pack.js +4 -4
  39. package/lib/{counter/task → system}/gc-action.js +74 -27
  40. package/lib/trace/trace-context-manager.js +25 -113
  41. package/lib/trace/trace-context.js +7 -21
  42. package/lib/trace/trace-httpc.js +11 -17
  43. package/lib/trace/trace-sql.js +21 -29
  44. package/lib/udp/async_sender.js +119 -0
  45. package/lib/udp/index.js +17 -0
  46. package/lib/udp/packet_enum.js +52 -0
  47. package/lib/udp/packet_queue.js +69 -0
  48. package/lib/udp/packet_type_enum.js +33 -0
  49. package/lib/udp/param_def.js +72 -0
  50. package/lib/udp/udp_session.js +336 -0
  51. package/lib/util/escape-literal-sql.js +5 -5
  52. package/lib/util/hashutil.js +18 -18
  53. package/lib/util/keygen.js +3 -0
  54. package/lib/util/linkedset.js +2 -1
  55. package/lib/util/nodeutil.js +1 -2
  56. package/lib/util/sql-util.js +178 -0
  57. package/lib/util/trace-helper.js +91 -0
  58. package/lib/util/transfer.js +58 -0
  59. package/lib/value/map-value.js +2 -3
  60. package/package.json +5 -10
  61. package/whatap.conf +4 -1
  62. package/lib/conf/conf-sys-mon.js +0 -101
  63. package/lib/control/cmd-config.js +0 -24
  64. package/lib/control/control-handler.js +0 -367
  65. package/lib/core/request-agent.js +0 -27
  66. package/lib/counter/meter/meter-activex.js +0 -67
  67. package/lib/counter/meter/meter-httpc.js +0 -57
  68. package/lib/counter/meter/meter-resource.js +0 -9
  69. package/lib/counter/meter/meter-service.js +0 -168
  70. package/lib/counter/meter/meter-socket.io.js +0 -51
  71. package/lib/counter/meter/meter-sql.js +0 -71
  72. package/lib/counter/meter/meter-users.js +0 -58
  73. package/lib/counter/meter.js +0 -183
  74. package/lib/counter/task/agentinfo.js +0 -107
  75. package/lib/counter/task/gcstat.js +0 -34
  76. package/lib/counter/task/heapmem.js +0 -25
  77. package/lib/counter/task/httpc.js +0 -76
  78. package/lib/counter/task/metering-info.js +0 -125
  79. package/lib/counter/task/proc-cpu.js +0 -29
  80. package/lib/counter/task/realtimeuser.js +0 -31
  81. package/lib/counter/task/res/systemECSTask.js +0 -39
  82. package/lib/counter/task/res/systemKubeTask.js +0 -53
  83. package/lib/counter/task/res/util/awsEcsClientThread.js +0 -218
  84. package/lib/counter/task/res/util/linuxProcStatUtil.js +0 -14
  85. package/lib/counter/task/res-sys-cpu.js +0 -62
  86. package/lib/counter/task/service.js +0 -202
  87. package/lib/counter/task/socketio.js +0 -30
  88. package/lib/counter/task/sql.js +0 -105
  89. package/lib/counter/task/systemperf.js +0 -43
  90. package/lib/data/datapack-sender.js +0 -289
  91. package/lib/data/dataprofile-agent.js +0 -162
  92. package/lib/data/datatext-agent.js +0 -135
  93. package/lib/data/event-level.js +0 -15
  94. package/lib/data/test.js +0 -49
  95. package/lib/data/zipprofile.js +0 -197
  96. package/lib/env/constants.js +0 -21
  97. package/lib/error/error-handler.js +0 -437
  98. package/lib/kube/kube-client.js +0 -144
  99. package/lib/lang/text-types.js +0 -58
  100. package/lib/logsink/line-log-util.js +0 -87
  101. package/lib/logsink/line-log.js +0 -12
  102. package/lib/logsink/log-sender.js +0 -78
  103. package/lib/logsink/log-tracer.js +0 -40
  104. package/lib/logsink/sender-util.js +0 -56
  105. package/lib/logsink/zip/zip-send.js +0 -177
  106. package/lib/net/netflag.js +0 -55
  107. package/lib/net/receiver.js +0 -66
  108. package/lib/net/sender.js +0 -141
  109. package/lib/net/tcp-return.js +0 -18
  110. package/lib/net/tcp-session.js +0 -286
  111. package/lib/net/tcpreq-client-proxy.js +0 -70
  112. package/lib/net/tcprequest-mgr.js +0 -58
  113. package/lib/observers/cluster-observer.js +0 -22
  114. package/lib/observers/express-observer.js +0 -215
  115. package/lib/observers/file-observer.js +0 -184
  116. package/lib/observers/grpc-observer.js +0 -336
  117. package/lib/observers/memcached-observer.js +0 -56
  118. package/lib/observers/mongo-observer.js +0 -317
  119. package/lib/observers/net-observer.js +0 -77
  120. package/lib/observers/promise-observer.js +0 -31
  121. package/lib/observers/schedule-observer.js +0 -67
  122. package/lib/observers/stream-observer.js +0 -19
  123. package/lib/observers/thrift-observer.js +0 -197
  124. package/lib/pack/activestack-pack.js +0 -55
  125. package/lib/pack/apenum.js +0 -8
  126. package/lib/pack/errorsnap-pack.js +0 -69
  127. package/lib/pack/event-pack.js +0 -54
  128. package/lib/pack/hitmap-pack.js +0 -63
  129. package/lib/pack/hitmap-pack1.js +0 -152
  130. package/lib/pack/netstat.js +0 -15
  131. package/lib/pack/otype.js +0 -7
  132. package/lib/pack/profile-pack.js +0 -49
  133. package/lib/pack/realtimeuser-pack.js +0 -41
  134. package/lib/pack/stat-general-pack.js +0 -96
  135. package/lib/pack/staterror-pack.js +0 -120
  136. package/lib/pack/stathttpc-pack.js +0 -66
  137. package/lib/pack/stathttpc-rec.js +0 -78
  138. package/lib/pack/statremote-pack.js +0 -46
  139. package/lib/pack/statservice-pack.js +0 -63
  140. package/lib/pack/statservice-pack1.js +0 -88
  141. package/lib/pack/statservice-rec.js +0 -292
  142. package/lib/pack/statservice-rec_dep.js +0 -151
  143. package/lib/pack/statsql-pack.js +0 -69
  144. package/lib/pack/statsql-rec.js +0 -100
  145. package/lib/pack/statuseragent-pack.js +0 -44
  146. package/lib/pack/tagctr.js +0 -15
  147. package/lib/pack/text-pack.js +0 -50
  148. package/lib/pack/time-count.js +0 -25
  149. package/lib/pack/websocket.js +0 -15
  150. package/lib/pack/zip-pack.js +0 -70
  151. package/lib/pii/pii-item.js +0 -31
  152. package/lib/pii/pii-mask.js +0 -174
  153. package/lib/plugin/plugin-loadermanager.js +0 -57
  154. package/lib/plugin/plugin.js +0 -75
  155. package/lib/service/tx-record.js +0 -332
  156. package/lib/stat/stat-error.js +0 -116
  157. package/lib/stat/stat-httpc.js +0 -98
  158. package/lib/stat/stat-remote-ip.js +0 -46
  159. package/lib/stat/stat-remote-ipurl.js +0 -88
  160. package/lib/stat/stat-sql.js +0 -113
  161. package/lib/stat/stat-tranx.js +0 -58
  162. package/lib/stat/stat-tx-caller.js +0 -160
  163. package/lib/stat/stat-tx-domain.js +0 -111
  164. package/lib/stat/stat-tx-referer.js +0 -112
  165. package/lib/stat/stat-useragent.js +0 -48
  166. package/lib/stat/timingsender.js +0 -76
  167. package/lib/step/activestack-step.js +0 -38
  168. package/lib/step/dbc-step.js +0 -36
  169. package/lib/step/http-stepx.js +0 -67
  170. package/lib/step/message-step.js +0 -40
  171. package/lib/step/method-stepx.js +0 -45
  172. package/lib/step/resultset-step.js +0 -40
  173. package/lib/step/securemsg-step.js +0 -44
  174. package/lib/step/socket-step.js +0 -46
  175. package/lib/step/sql-stepx.js +0 -68
  176. package/lib/step/sqlxtype.js +0 -16
  177. package/lib/step/step.js +0 -66
  178. package/lib/step/stepenum.js +0 -54
  179. package/lib/topology/link.js +0 -63
  180. package/lib/topology/nodeinfo.js +0 -123
  181. package/lib/topology/status-detector.js +0 -111
  182. package/lib/util/anylist.js +0 -103
  183. package/lib/util/cardinality/hyperloglog.js +0 -106
  184. package/lib/util/cardinality/murmurhash.js +0 -31
  185. package/lib/util/cardinality/registerset.js +0 -75
  186. package/lib/util/errordata.js +0 -21
  187. package/lib/util/iputil_x.js +0 -527
  188. package/lib/util/kube-util.js +0 -73
  189. package/lib/util/paramsecurity.js +0 -80
  190. package/lib/util/pre-process.js +0 -13
  191. package/lib/util/process-seq.js +0 -166
  192. package/lib/util/property-util.js +0 -36
  193. package/lib/util/request-queue.js +0 -70
  194. package/lib/util/requestdouble-queue.js +0 -72
  195. package/lib/util/resourceprofile.js +0 -157
  196. package/lib/util/stop-watch.js +0 -30
  197. package/lib/util/system-util.js +0 -10
  198. package/lib/util/userid-util.js +0 -57
@@ -1,41 +0,0 @@
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;
@@ -1,96 +0,0 @@
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;
@@ -1,120 +0,0 @@
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
- BitUtil = require('../util/bitutil'),
10
- DataOutputX = require('../io/data-outputx'),
11
- DataInputX = require('../io/data-inputx'),
12
- Long = require('long');
13
-
14
- function ErrorRec() {
15
- this.classHash = 0;
16
- this.service = 0;
17
- this.snapSeq = Long.ZERO;
18
- this.msg = 0;
19
- this.count = 0;
20
-
21
- this.merge = function(rec) {
22
- if(rec instanceof ErrorRec) {
23
- this.count += rec.count;
24
- }
25
- };
26
-
27
- this.getKey = function () {
28
- return BitUtil.composite(this.classHash, this.service);
29
- }
30
- }
31
-
32
- function StatErrorPack() {
33
- Pack.call(this);
34
- this.records = null;
35
- this.record_count = 0;
36
-
37
- this.setRecords = function(size /*int*/, items /*Enumeration<ErrorRec>*/) {
38
- var dout = new DataOutputX();
39
- dout.writeShort(size);
40
-
41
- while(items.hasMoreElements()) {
42
- StatErrorPack.writeRec(dout, items.nextElement());
43
- }
44
- /*
45
- for (i = 0; i < size; i++) {
46
- StatErrorPack.writeRec(dout, items.nextElement());
47
- }
48
- */
49
- this.records = dout.toByteArray();
50
- this.record_count = size;
51
- return this;
52
- };
53
-
54
- this.getRecords = function() {
55
- var items = [];
56
- if (this.records == null ) {
57
- return null;
58
- }
59
-
60
- var din = new DataInputX(this.records);
61
- var i;
62
- for (i = 0; i < din.readShort(); i++) {
63
- items.push(StatErrorPack.readRec(din));
64
- }
65
- return items;
66
- };
67
- }
68
-
69
-
70
- StatErrorPack.writeRec = function(dout, m){
71
- if(m instanceof ErrorRec) {
72
- dout.writeInt(m.classHash);
73
- dout.writeInt(m.service);
74
- dout.writeLong(m.snapSeq);
75
- dout.writeDecimal(m.msg);
76
- dout.writeDecimal(m.count);
77
- }
78
- };
79
-
80
- StatErrorPack.readRec = function(din) {
81
- var m = new ErrorRec();
82
- m.classHash = din.readInt();
83
- m.service = din.readInt();
84
- m.snapSeq = din.readLong();
85
- m.msg = din.readDecNumber();
86
- m.count = din.readDecNumber();
87
- return m;
88
- };
89
-
90
- StatErrorPack.prototype = new Pack();
91
- StatErrorPack.prototype.constructor = StatErrorPack;
92
-
93
- StatErrorPack.prototype.getPackType = function() {
94
- return PackEnum.STAT_ERROR;
95
- };
96
-
97
- StatErrorPack.prototype.write = function(dout) {
98
- Pack.prototype.write.call(this, dout);
99
- dout.writeBlob(this.records);
100
- dout.writeDecimal(this.record_count);
101
- };
102
-
103
- StatErrorPack.prototype.read = function(din) {
104
- Pack.prototype.read.call(this, din);
105
- this.records = din.readBlob();
106
- this.record_count = din.readDecNumber();
107
- return this;
108
- };
109
-
110
- StatErrorPack.prototype.toString = function() {
111
- return 'StatError '
112
- + Pack.prototype.toString.call(this)
113
- + ', records='
114
- + this.record_count
115
- + ", bytes="
116
- + (this.records != null ? this.records.length : 0);
117
- };
118
-
119
- exports.ErrorRec = ErrorRec;
120
- exports.StatErrorPack = StatErrorPack;
@@ -1,66 +0,0 @@
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
- HttpcRec = require('./stathttpc-rec');
12
-
13
- function StatHttpcPack() {
14
- Pack.call(this);
15
-
16
- this.records = null; /*byte[]*/
17
- this.record_count = 0; /*int*/
18
- }
19
-
20
- StatHttpcPack.prototype = new Pack();
21
- StatHttpcPack.prototype.constructor = StatHttpcPack;
22
- StatHttpcPack.prototype.getPackType = function(){
23
- return PackEnum.STAT_HTTPC;
24
- };
25
- StatHttpcPack.prototype.setRecords = function(size /*int*/, items /*Enumeration<HttpcRec>*/) {
26
- var dout = new DataOutputX();
27
- dout.writeShort(size);
28
- while(items.hasMoreElements()) {
29
- HttpcRec.writeRec(dout, items.nextElement());
30
- }
31
- /*
32
- for (var i = 0; i < size; i++) {
33
- items.nextElement().write(dout);
34
- }
35
- */
36
- this.records = dout.toByteArray();
37
- this.record_count = size;
38
- return this;
39
- };
40
-
41
- StatHttpcPack.prototype.getRecords = function() {
42
- var items = [];
43
- if (this.records == null ) {
44
- return null;
45
- }
46
-
47
- var din = new DataInputX(this.records);
48
- for (var i = 0; i < din.readShort(); i++) {
49
- items.push(new HttpcRec().read(din));
50
- }
51
- return items;
52
- };
53
- StatHttpcPack.prototype.write = function(dout) {
54
- Pack.prototype.write.call(this, dout);
55
- dout.writeBlob(this.records);
56
- dout.writeDecimal(this.record_count);
57
- };
58
-
59
- StatHttpcPack.prototype.read = function(din) {
60
- Pack.prototype.read.call(this, din);
61
- this.records = din.readBlob();
62
- this.record_count = din.readDecNumber();
63
- return this;
64
- };
65
-
66
- module.exports = StatHttpcPack;
@@ -1,78 +0,0 @@
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
- DataOutputX = require('../io/data-outputx'),
9
- DataInputX = require('../io/data-inputx');
10
-
11
- function HttpcRec(){
12
- this.url = 0;
13
- this.host = 0;
14
- this.port = 0;
15
- this.count_total = 0;
16
- this.count_error = 0;
17
- this.time_sum = 0;
18
- this.time_std = 0;
19
- this.time_min = 0;
20
- this.time_max = 0;
21
- this.service = 0;
22
- }
23
- HttpcRec.prototype.merge = function (o) {
24
- this.count_total += o.count_total;
25
- this.count_error += o.count_error;
26
- this.time_sum += o.time_sum;
27
- this.time_std = o.time_std;
28
- this.time_max = Math.max(this.time_max, o.time_max);
29
- this.time_min = Math.min(this.time_min, o.time_min);
30
- };
31
-
32
- HttpcRec.prototype.write = function(dout){
33
- dout.writeInt(this.url);
34
- dout.writeInt(this.host);
35
- dout.writeInt(this.port);
36
- dout.writeDecimal(this.count_total);
37
- dout.writeDecimal(this.count_error);
38
- dout.writeDecimal(-1);
39
- dout.writeDecimal(this.time_sum);
40
- dout.writeDecimal(this.time_std);
41
- dout.writeDecimal(this.time_min);
42
- dout.writeDecimal(this.time_max);
43
-
44
- dout.writeDecimal(this.service);
45
- };
46
- HttpcRec.prototype.read = function(din) {
47
- this.url = din.readInt();
48
- this.host = din.readInt();
49
- this.port = din.readInt();
50
- this.count_total = din.readDecNumber();
51
- this.count_error = din.readDecNumber();
52
- var ver = din.readDecNumber();
53
- this.time_sum = din.readDecNumber();
54
- this.time_std = din.readDecNumber();
55
- this.time_min = din.readDecNumber();
56
- this.time_max = din.readDecNumber();
57
- if(ver>=0){
58
- return this;
59
- }
60
- this.service = din.readDecNumber();
61
- return this;
62
- };
63
- HttpcRec.writeRec = function(dout , m){
64
- dout.writeInt(m.url);
65
- dout.writeInt(m.host);
66
- dout.writeInt(m.port);
67
- dout.writeDecimal(m.count_total);
68
- dout.writeDecimal(m.count_error);
69
- dout.writeDecimal(-1);
70
- dout.writeDecimal(m.time_sum);
71
- dout.writeDecimal(m.time_std);
72
- dout.writeDecimal(m.time_min);
73
- dout.writeDecimal(m.time_max);
74
-
75
- dout.writeDecimal(m.service);
76
- };
77
-
78
- module.exports = HttpcRec;
@@ -1,46 +0,0 @@
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 StatRemoteIpPack(){
12
- Pack.call(this);
13
- this.iptable = new IntIntMap();
14
- }
15
-
16
- StatRemoteIpPack.prototype = new Pack();
17
- StatRemoteIpPack.prototype.constructor = StatRemoteIpPack;
18
- StatRemoteIpPack.prototype.getPackType = function () {
19
- return PackEnum.STAT_REMOTE_IP;
20
- };
21
- StatRemoteIpPack.prototype.write = function(dout) {
22
- Pack.prototype.write.call(this, dout);
23
-
24
- dout.writeDecimal(this.iptable.size());
25
- var en = this.iptable.entries();
26
- while(en.hasMoreElements()) {
27
- var e = en.nextElement();
28
- dout.writeInt(e.getKey());
29
- dout.writeInt(e.getValue());
30
- }
31
- };
32
- StatRemoteIpPack.prototype.read = function(din) {
33
- Pack.prototype.read.call(this, din);
34
- var ip, count;
35
- var cnt = din.readDecNumber();
36
- this.iptable = new IntIntMap();
37
-
38
- for(var i=0; i<cnt; i++) {
39
- ip = din.readInt();
40
- count = din.readInt();
41
- this.iptable.put(ip, count);
42
- }
43
- return this;
44
- };
45
-
46
- module.exports = StatRemoteIpPack;
@@ -1,63 +0,0 @@
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
- TransactionRec = require('./statservice-rec'),
10
- DataOutputX = require('../io/data-outputx'),
11
- DataInputX = require('../io/data-inputx');
12
-
13
- function StatServicePack(){
14
- Pack.call(this);
15
-
16
- this.records = null; /*byte[]*/
17
- this.record_count = 0; /*int*/
18
-
19
- return this;
20
- }
21
-
22
- StatServicePack.prototype = new Pack();
23
- StatServicePack.prototype.constructor = StatServicePack;
24
- StatServicePack.prototype.getPackType = function(){
25
- return PackEnum.STAT_SERVICE;
26
- };
27
- StatServicePack.prototype.write = function(dout){
28
- Pack.prototype.write.call(this, dout);
29
- dout.writeBlob(this.records);
30
- dout.writeDecimal(this.record_count);
31
- };
32
- StatServicePack.prototype.read = function(din){
33
- Pack.prototype.read.call(this, din);
34
- this.records = din.readBlob();
35
- this.record_count = din.readDecNumber();
36
- return this;
37
- };
38
- StatServicePack.prototype.setRecords = function(size /*int*/, items /*Enumer<TransactionRec>*/) {
39
- var dout = new DataOutputX();
40
- dout.writeShort(size);
41
- while(items.hasMoreElements()) {
42
- TransactionRec.writeRec(dout, items.nextElement());
43
- }
44
- this.records = dout.toByteArray();
45
- this.record_count = size;
46
- return this;
47
- };
48
- StatServicePack.prototype.getRecords = function() {
49
- var items = [];
50
- if (this.records == null) {
51
- return [];
52
- }
53
-
54
- var din = new DataInputX(this.records);
55
- var cnt=din.readShort();
56
- for (var i = 0; i < cnt; i++) {
57
- // items.push(new TransactionRec().read(din));
58
- items.push(TransactionRec.readRec(din));
59
- }
60
- return items;
61
- };
62
-
63
- module.exports = StatServicePack;
@@ -1,88 +0,0 @@
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
- TransactionRec = require('./statservice-rec'),
10
- DataOutputX = require('../io/data-outputx'),
11
- DataInputX = require('../io/data-inputx');
12
-
13
- function StatServicePack1(){
14
- Pack.call(this);
15
-
16
- this.records = null; /*byte[]*/
17
- this.record_count = 0; /*int*/
18
-
19
- this.spec = 0;
20
- return this;
21
- }
22
-
23
- StatServicePack1.prototype = new Pack();
24
- StatServicePack1.prototype.constructor = StatServicePack1;
25
-
26
- StatServicePack1.prototype.getPackType = function(){
27
- return PackEnum.STAT_SERVICE_1;
28
- };
29
-
30
- StatServicePack1.prototype.write = function(dout){
31
- Pack.prototype.write.call(this, dout);
32
-
33
- dout.writeBlob(this.records);
34
- dout.writeDecimal(this.record_count);
35
-
36
- dout.writeByte(0);
37
- dout.writeDecimal(this.spec);
38
- };
39
-
40
- StatServicePack1.prototype.read = function(din){
41
- Pack.prototype.read.call(this, din);
42
- this.records = din.readBlob();
43
- this.record_count = din.readDecNumber();
44
-
45
- var ver = din.readByte();
46
- this.spec = din.readDecimal();
47
-
48
- return this;
49
- };
50
-
51
- StatServicePack1.prototype.setRecords = function(size /*int*/, items /*Enumer<TransactionRec>*/) {
52
- var dout = new DataOutputX();
53
- dout.writeShort(size);
54
-
55
- while(items.hasMoreElements()) {
56
- let aa = items.nextElement();
57
- TransactionRec.writeRec(dout, aa);
58
- }
59
-
60
- this.records = dout.toByteArray();
61
- this.record_count = size;
62
- return this;
63
- };
64
-
65
- StatServicePack1.prototype.getRecords = function() {
66
- var items = [];
67
- if (this.records == null) {
68
- return [];
69
- }
70
-
71
- var din = new DataInputX(this.records);
72
- var size = din.readShort();
73
- for (var i = 0; i < size; i++) {
74
- items.push(new TransactionRec().read(din));
75
- }
76
- return items;
77
- };
78
-
79
- StatServicePack1.prototype.toString = function() {
80
- return 'StatServicePack1 '
81
- + Pack.prototype.toString.call(this)
82
- + ', records='
83
- + this.record_count
84
- + ", bytes="
85
- + (this.records != null ? this.records.length : 0);
86
- };
87
-
88
- module.exports = StatServicePack1;