whatap 0.5.27 → 0.5.28

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.
@@ -15,7 +15,15 @@ IntKeyMap.prototype.constructor = IntKeyMap;
15
15
  IntKeyMap.prototype.create = function () {throw new Error("create method not implemented!!")};
16
16
 
17
17
  IntKeyMap.prototype.hash = function (key /*int*/) {
18
- return Math.abs(key);
18
+ // 문자열 키(예: 16자리 hex txid)는 Math.abs 결과가 NaN/Infinity 가 되어 모든 항목이 table[NaN] 에
19
+ // 쌓이고, rehash 가 숫자 인덱스만 옮기면서 유실된다. 버킷 인덱스로 쓸 수 없는 값은 문자열 해시로 대체한다.
20
+ if (typeof key !== 'string') {
21
+ var h = Math.abs(key);
22
+ if (isFinite(h)) {
23
+ return h;
24
+ }
25
+ }
26
+ return Math.abs(this.strHash(String(key)));
19
27
  };
20
28
  IntKeyMap.prototype.equals = function (key1, key2) {
21
29
  return key1===key2;
@@ -257,17 +257,13 @@ LinkedMap.prototype._put = function (key, value, m) {
257
257
  case MODE.FORCE_FIRST:
258
258
  case MODE.FIRST:
259
259
  while( this.count >= this.max ) {
260
- var k = this.header.link_prev.key;
261
- var v = this.remove(k);
262
- this.overflowed(k, v);
260
+ this.evict(this.header.link_prev);
263
261
  }
264
262
  break;
265
263
  case MODE.FORCE_LAST:
266
264
  case MODE.LAST:
267
265
  while( this.count >= this.max ) {
268
- var k = this.header.link_next.key;
269
- var v = this.remove(k);
270
- this.overflowed(k, v);
266
+ this.evict(this.header.link_next);
271
267
  }
272
268
  break;
273
269
  }
@@ -337,17 +333,13 @@ LinkedMap.prototype._add = function (key, value, m, noover) {
337
333
  case MODE.FORCE_FIRST:
338
334
  case MODE.FIRST:
339
335
  while( this.count >= this.max ) {
340
- var k = this.header.link_prev.key;
341
- var v = this.remove(k);
342
- this.overflowed(k, v);
336
+ this.evict(this.header.link_prev);
343
337
  }
344
338
  break;
345
339
  case MODE.FORCE_LAST:
346
340
  case MODE.LAST:
347
341
  while( this.count >= this.max ) {
348
- var k = this.header.link_next.key;
349
- var v = this.remove(k);
350
- this.overflowed(k, v);
342
+ this.evict(this.header.link_next);
351
343
  }
352
344
  break;
353
345
  }
@@ -434,6 +426,20 @@ LinkedMap.prototype._addNoOver = function (key, value, m, noover) {
434
426
 
435
427
  LinkedMap.prototype.overflowed = function (key, value) {
436
428
  };
429
+ // max 초과 시 항목 하나를 밀어낸다. 해시 테이블에서 찾지 못하는 항목(테이블과 연결 리스트 불일치)이면
430
+ // remove 가 count 를 줄이지 못해 호출부의 while 루프가 끝나지 않으므로, 연결 리스트에서 직접 떼어낸다.
431
+ LinkedMap.prototype.evict = function (e) {
432
+ var k = e.key;
433
+ var before = this.count;
434
+ var v = this.remove(k);
435
+ if(this.count === before) {
436
+ v = e.value;
437
+ e.value = null;
438
+ this.unchain(e);
439
+ this.count--;
440
+ }
441
+ this.overflowed(k, v);
442
+ };
437
443
  LinkedMap.prototype.create = function (key) {
438
444
  throw new Error('not implemented create()');
439
445
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "whatap",
3
3
  "homepage": "http://www.whatap.io",
4
- "version": "0.5.27",
5
- "releaseDate": "20260611",
4
+ "version": "0.5.28",
5
+ "releaseDate": "20261125",
6
6
  "description": "Monitoring and Profiling Service",
7
7
  "main": "index.js",
8
8
  "scripts": {},
@@ -1,77 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(grep -n \"ECONNREFUSED\" /Users/seunghunlee/agent_workspace/nodejs_agent/lib/observers/*.js /Users/seunghunlee/agent_workspace/nodejs_agent/lib/core/agent.js 2>/dev/null)",
5
- "WebSearch",
6
- "Bash(go env *)",
7
- "Bash(ls -l \"$\\(go env GOPATH\\)/bin/govulncheck\")",
8
- "Bash(brew list *)",
9
- "Bash(brew search *)",
10
- "Bash(brew info *)",
11
- "Bash(echo \"--- exit $? ---\")",
12
- "Bash(go version *)",
13
- "WebFetch(domain:github.com)",
14
- "Read(//Users/seunghunlee/workspace/**)",
15
- "Read(//Users/seunghunlee/workspace/nodejs_docker_sample/**)",
16
- "Bash(npm i *)",
17
- "Bash(chmod +x /Users/seunghunlee/workspace/nodejs_docker_sample/repro.sh)",
18
- "Bash(docker exec 273976be9e71 *)",
19
- "Bash(docker rm *)",
20
- "Bash(docker build *)",
21
- "Bash(docker run *)",
22
- "Bash(docker exec zombie-test *)",
23
- "Bash(curl -s http://localhost:3000/)",
24
- "Bash(curl -s http://localhost:3000/health)",
25
- "Bash(curl -s http://localhost:3000/slow)",
26
- "Bash(curl -s -o /dev/null -w \"status: %{http_code}\\\\n\" http://localhost:3000/error)",
27
- "Bash(curl -s -o /dev/null -w \"%{http_code} \" http://localhost:3000/)",
28
- "Bash(/usr/local/bin/docker exec *)",
29
- "Bash(/usr/local/bin/docker build *)",
30
- "Bash(/usr/local/bin/docker rm *)",
31
- "Bash(/usr/local/bin/docker run *)",
32
- "Bash(/bin/sleep 30)",
33
- "Bash(echo \"[$\\(date +%T\\)] zombies=$\\(/usr/local/bin/docker exec zombie-test sh -c \"ps -eo stat | awk '\\\\$1 ~ /^Z/' | wc -l\"\\)\")",
34
- "Bash(/bin/sleep 5)",
35
- "Bash(/usr/local/bin/docker ps *)",
36
- "Bash(/bin/sleep 6)",
37
- "Bash(/usr/local/bin/docker logs *)",
38
- "Bash(/usr/bin/curl -s http://localhost:3000/)",
39
- "Bash(/usr/bin/curl -s http://localhost:3000/health)",
40
- "Bash(/bin/sleep 7)",
41
- "Bash(cat agent/index.js)",
42
- "Bash(cat agent/writer.js)",
43
- "Bash(node -e \"const d=require\\('./config/defaults.js'\\); console.log\\('flushInterval=', d.flushInterval\\)\")",
44
- "Bash(cd *)",
45
- "Bash(ls /Users/seunghunlee/workspace/nodejs_docker_sample/node_modules/whatap/lib)",
46
- "Bash(ls /Users/seunghunlee/workspace/nodejs_docker_sample/node_modules/whatap/index.js)",
47
- "Bash(node -e ' *)",
48
- "Bash(export WHATAP_HOME=/tmp)",
49
- "Bash(node --expose-gc -e ' *)",
50
- "Bash(node -p \"process.platform+'/'+process.arch+' node '+process.version\")",
51
- "Read(//Users/seunghunlee/agent_workspace/apm-go-agent/**)",
52
- "Bash(node -e \"require\\('./lib/counter/task/metering-info'\\); console.log\\('module load OK'\\);\")",
53
- "Bash(node --check lib/counter/task/metering-info.js)",
54
- "Bash(node --check lib/util/cgroup-cpu.js)",
55
- "Bash(node -e \"var m=require\\('./index.js'\\); console.log\\('exports keys:', Object.keys\\(m\\)\\);\")",
56
- "Bash(docker version *)",
57
- "Bash(rm -rf whatap-local)",
58
- "Bash(rsync -a --exclude=.git --exclude=node_modules --exclude=logs --exclude=*.log /Users/seunghunlee/agent_workspace/nodejs_agent/ ./whatap-local/)",
59
- "Bash(node *)",
60
- "Bash(npm view *)",
61
- "Bash(rsync -a --delete --exclude=.git --exclude=node_modules --exclude=logs --exclude=*.log /Users/seunghunlee/agent_workspace/nodejs_agent/ ./whatap-local/)",
62
- "Bash(docker exec *)",
63
- "Bash(curl -s --max-time 5 http://localhost:3001/health)",
64
- "Bash(curl -s --max-time 5 http://localhost:3002/health)",
65
- "Bash(sed -n '66,71p' lib/counter/counter-manager.js)",
66
- "Bash(sed -n '166,168p' lib/conf/configure.js)",
67
- "Bash(sed -n '40,70p' lib/kube/kube-client.js)",
68
- "Bash(docker info *)",
69
- "Bash(« stray *)",
70
- "Bash(awk '{print $1}')",
71
- "Bash(xargs -r docker rm -f)",
72
- "Read(//Users/seunghunlee/agent_workspace/**)",
73
- "Bash(net_udp_packet_queue_size=500 node -e ' *)",
74
- "Bash(max_send_queue_size=500 node -e ' *)"
75
- ]
76
- }
77
- }