whatap 0.5.26 → 1.0.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 (196) hide show
  1. package/agent/darwin/arm64/whatap_nodejs +0 -0
  2. package/agent/linux/amd64/whatap_nodejs +0 -0
  3. package/agent/linux/arm64/whatap_nodejs +0 -0
  4. package/build.txt +4 -0
  5. package/lib/conf/config-default.js +3 -10
  6. package/lib/conf/configure.js +349 -369
  7. package/lib/conf/license.js +1 -1
  8. package/lib/control/packagectr-helper.js +3 -34
  9. package/lib/core/agent.js +882 -176
  10. package/lib/core/interceptor.js +6 -6
  11. package/lib/core/shimmer.js +36 -82
  12. package/lib/counter/counter-manager.js +8 -79
  13. package/lib/counter/task/activetransaction.js +17 -68
  14. package/lib/io/data-inputx.js +3 -13
  15. package/lib/io/data-outputx.js +206 -268
  16. package/lib/logger.js +6 -6
  17. package/lib/net/security-master.js +20 -139
  18. package/lib/observers/apollo-server-observer.js +27 -33
  19. package/lib/observers/global-observer.js +80 -155
  20. package/lib/observers/http-observer.js +236 -666
  21. package/lib/observers/ioredis-observer.js +294 -0
  22. package/lib/observers/maria-observer.js +362 -204
  23. package/lib/observers/mongodb-observer.js +226 -169
  24. package/lib/observers/mongoose-observer.js +323 -518
  25. package/lib/observers/mssql-observer.js +418 -177
  26. package/lib/observers/mysql-observer.js +449 -342
  27. package/lib/observers/mysql2-observer.js +358 -396
  28. package/lib/observers/oracle-observer.js +384 -559
  29. package/lib/observers/pgsql-observer.js +489 -231
  30. package/lib/observers/prisma-observer.js +92 -303
  31. package/lib/observers/process-observer.js +35 -79
  32. package/lib/observers/redis-observer.js +331 -166
  33. package/lib/observers/socket.io-observer.js +187 -226
  34. package/lib/observers/websocket-observer.js +301 -175
  35. package/lib/pack/counter-pack.js +0 -3
  36. package/lib/pack/log-sink-pack.js +52 -14
  37. package/lib/pack/tagcount-pack.js +4 -4
  38. package/lib/{counter/task → system}/gc-action.js +74 -27
  39. package/lib/trace/trace-context-manager.js +25 -113
  40. package/lib/trace/trace-context.js +7 -21
  41. package/lib/trace/trace-httpc.js +11 -17
  42. package/lib/trace/trace-sql.js +21 -29
  43. package/lib/udp/async_sender.js +119 -0
  44. package/lib/udp/index.js +17 -0
  45. package/lib/udp/packet_enum.js +52 -0
  46. package/lib/udp/packet_queue.js +69 -0
  47. package/lib/udp/packet_type_enum.js +33 -0
  48. package/lib/udp/param_def.js +72 -0
  49. package/lib/udp/udp_session.js +336 -0
  50. package/lib/util/escape-literal-sql.js +5 -5
  51. package/lib/util/hashutil.js +18 -18
  52. package/lib/util/keygen.js +3 -0
  53. package/lib/util/linkedset.js +2 -1
  54. package/lib/util/nodeutil.js +1 -2
  55. package/lib/util/sql-util.js +178 -0
  56. package/lib/util/trace-helper.js +91 -0
  57. package/lib/util/transfer.js +58 -0
  58. package/lib/value/map-value.js +2 -3
  59. package/package.json +5 -10
  60. package/lib/conf/conf-sys-mon.js +0 -101
  61. package/lib/control/cmd-config.js +0 -24
  62. package/lib/control/control-handler.js +0 -367
  63. package/lib/core/request-agent.js +0 -27
  64. package/lib/counter/meter/meter-activex.js +0 -67
  65. package/lib/counter/meter/meter-httpc.js +0 -57
  66. package/lib/counter/meter/meter-resource.js +0 -9
  67. package/lib/counter/meter/meter-service.js +0 -168
  68. package/lib/counter/meter/meter-socket.io.js +0 -51
  69. package/lib/counter/meter/meter-sql.js +0 -71
  70. package/lib/counter/meter/meter-users.js +0 -58
  71. package/lib/counter/meter.js +0 -183
  72. package/lib/counter/task/agentinfo.js +0 -107
  73. package/lib/counter/task/gcstat.js +0 -34
  74. package/lib/counter/task/heapmem.js +0 -25
  75. package/lib/counter/task/httpc.js +0 -76
  76. package/lib/counter/task/metering-info.js +0 -125
  77. package/lib/counter/task/proc-cpu.js +0 -29
  78. package/lib/counter/task/realtimeuser.js +0 -31
  79. package/lib/counter/task/res/systemECSTask.js +0 -39
  80. package/lib/counter/task/res/systemKubeTask.js +0 -53
  81. package/lib/counter/task/res/util/awsEcsClientThread.js +0 -218
  82. package/lib/counter/task/res/util/linuxProcStatUtil.js +0 -14
  83. package/lib/counter/task/res-sys-cpu.js +0 -62
  84. package/lib/counter/task/service.js +0 -202
  85. package/lib/counter/task/socketio.js +0 -30
  86. package/lib/counter/task/sql.js +0 -105
  87. package/lib/counter/task/systemperf.js +0 -43
  88. package/lib/data/datapack-sender.js +0 -289
  89. package/lib/data/dataprofile-agent.js +0 -162
  90. package/lib/data/datatext-agent.js +0 -135
  91. package/lib/data/event-level.js +0 -15
  92. package/lib/data/test.js +0 -49
  93. package/lib/data/zipprofile.js +0 -197
  94. package/lib/env/constants.js +0 -21
  95. package/lib/error/error-handler.js +0 -437
  96. package/lib/kube/kube-client.js +0 -144
  97. package/lib/lang/text-types.js +0 -58
  98. package/lib/logsink/line-log-util.js +0 -87
  99. package/lib/logsink/line-log.js +0 -12
  100. package/lib/logsink/log-sender.js +0 -78
  101. package/lib/logsink/log-tracer.js +0 -40
  102. package/lib/logsink/sender-util.js +0 -56
  103. package/lib/logsink/zip/zip-send.js +0 -177
  104. package/lib/net/netflag.js +0 -55
  105. package/lib/net/receiver.js +0 -66
  106. package/lib/net/sender.js +0 -141
  107. package/lib/net/tcp-return.js +0 -18
  108. package/lib/net/tcp-session.js +0 -286
  109. package/lib/net/tcpreq-client-proxy.js +0 -70
  110. package/lib/net/tcprequest-mgr.js +0 -58
  111. package/lib/observers/cluster-observer.js +0 -22
  112. package/lib/observers/express-observer.js +0 -215
  113. package/lib/observers/file-observer.js +0 -184
  114. package/lib/observers/grpc-observer.js +0 -336
  115. package/lib/observers/memcached-observer.js +0 -56
  116. package/lib/observers/mongo-observer.js +0 -317
  117. package/lib/observers/net-observer.js +0 -77
  118. package/lib/observers/promise-observer.js +0 -31
  119. package/lib/observers/schedule-observer.js +0 -67
  120. package/lib/observers/stream-observer.js +0 -19
  121. package/lib/observers/thrift-observer.js +0 -197
  122. package/lib/pack/activestack-pack.js +0 -55
  123. package/lib/pack/apenum.js +0 -8
  124. package/lib/pack/errorsnap-pack.js +0 -69
  125. package/lib/pack/event-pack.js +0 -54
  126. package/lib/pack/hitmap-pack.js +0 -63
  127. package/lib/pack/hitmap-pack1.js +0 -152
  128. package/lib/pack/netstat.js +0 -15
  129. package/lib/pack/otype.js +0 -7
  130. package/lib/pack/profile-pack.js +0 -49
  131. package/lib/pack/realtimeuser-pack.js +0 -41
  132. package/lib/pack/stat-general-pack.js +0 -96
  133. package/lib/pack/staterror-pack.js +0 -120
  134. package/lib/pack/stathttpc-pack.js +0 -66
  135. package/lib/pack/stathttpc-rec.js +0 -78
  136. package/lib/pack/statremote-pack.js +0 -46
  137. package/lib/pack/statservice-pack.js +0 -63
  138. package/lib/pack/statservice-pack1.js +0 -88
  139. package/lib/pack/statservice-rec.js +0 -292
  140. package/lib/pack/statservice-rec_dep.js +0 -151
  141. package/lib/pack/statsql-pack.js +0 -69
  142. package/lib/pack/statsql-rec.js +0 -100
  143. package/lib/pack/statuseragent-pack.js +0 -44
  144. package/lib/pack/tagctr.js +0 -15
  145. package/lib/pack/text-pack.js +0 -50
  146. package/lib/pack/time-count.js +0 -25
  147. package/lib/pack/websocket.js +0 -15
  148. package/lib/pack/zip-pack.js +0 -70
  149. package/lib/pii/pii-item.js +0 -31
  150. package/lib/pii/pii-mask.js +0 -174
  151. package/lib/plugin/plugin-loadermanager.js +0 -57
  152. package/lib/plugin/plugin.js +0 -75
  153. package/lib/service/tx-record.js +0 -332
  154. package/lib/stat/stat-error.js +0 -116
  155. package/lib/stat/stat-httpc.js +0 -98
  156. package/lib/stat/stat-remote-ip.js +0 -46
  157. package/lib/stat/stat-remote-ipurl.js +0 -88
  158. package/lib/stat/stat-sql.js +0 -113
  159. package/lib/stat/stat-tranx.js +0 -58
  160. package/lib/stat/stat-tx-caller.js +0 -160
  161. package/lib/stat/stat-tx-domain.js +0 -111
  162. package/lib/stat/stat-tx-referer.js +0 -112
  163. package/lib/stat/stat-useragent.js +0 -48
  164. package/lib/stat/timingsender.js +0 -76
  165. package/lib/step/activestack-step.js +0 -38
  166. package/lib/step/dbc-step.js +0 -36
  167. package/lib/step/http-stepx.js +0 -67
  168. package/lib/step/message-step.js +0 -40
  169. package/lib/step/method-stepx.js +0 -45
  170. package/lib/step/resultset-step.js +0 -40
  171. package/lib/step/securemsg-step.js +0 -44
  172. package/lib/step/socket-step.js +0 -46
  173. package/lib/step/sql-stepx.js +0 -68
  174. package/lib/step/sqlxtype.js +0 -16
  175. package/lib/step/step.js +0 -66
  176. package/lib/step/stepenum.js +0 -54
  177. package/lib/topology/link.js +0 -63
  178. package/lib/topology/nodeinfo.js +0 -123
  179. package/lib/topology/status-detector.js +0 -111
  180. package/lib/util/anylist.js +0 -103
  181. package/lib/util/cardinality/hyperloglog.js +0 -106
  182. package/lib/util/cardinality/murmurhash.js +0 -31
  183. package/lib/util/cardinality/registerset.js +0 -75
  184. package/lib/util/errordata.js +0 -21
  185. package/lib/util/iputil_x.js +0 -527
  186. package/lib/util/kube-util.js +0 -73
  187. package/lib/util/paramsecurity.js +0 -80
  188. package/lib/util/pre-process.js +0 -13
  189. package/lib/util/process-seq.js +0 -166
  190. package/lib/util/property-util.js +0 -36
  191. package/lib/util/request-queue.js +0 -70
  192. package/lib/util/requestdouble-queue.js +0 -72
  193. package/lib/util/resourceprofile.js +0 -157
  194. package/lib/util/stop-watch.js +0 -30
  195. package/lib/util/system-util.js +0 -10
  196. package/lib/util/userid-util.js +0 -57
@@ -1,292 +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
- 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;
@@ -1,151 +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
- 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;
@@ -1,69 +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
- 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;
@@ -1,100 +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
-
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;
@@ -1,44 +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 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;
@@ -1,15 +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
- 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;