@lensmcp/node-instrumentation 1.18.3 → 1.18.6

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 (46) hide show
  1. package/index.d.ts +0 -1
  2. package/index.js +1 -32
  3. package/lib/emit.d.ts +0 -1
  4. package/lib/emit.js +3 -187
  5. package/lib/flood-guard.d.ts +0 -1
  6. package/lib/flood-guard.js +1 -70
  7. package/lib/flow-context.d.ts +0 -1
  8. package/lib/flow-context.js +1 -57
  9. package/lib/install.d.ts +0 -1
  10. package/lib/install.js +1 -64
  11. package/lib/require-hook.d.ts +0 -1
  12. package/lib/require-hook.js +1 -52
  13. package/lib/tap-bullmq.d.ts +0 -1
  14. package/lib/tap-bullmq.js +1 -221
  15. package/lib/tap-egress.d.ts +0 -1
  16. package/lib/tap-egress.js +1 -158
  17. package/lib/tap-exec.d.ts +0 -1
  18. package/lib/tap-exec.js +1 -111
  19. package/lib/tap-fs.d.ts +0 -1
  20. package/lib/tap-fs.js +1 -156
  21. package/lib/tap-nest.d.ts +0 -1
  22. package/lib/tap-nest.js +1 -164
  23. package/lib/tap-pg.d.ts +0 -1
  24. package/lib/tap-pg.js +1 -122
  25. package/lib/tap-redis.d.ts +0 -1
  26. package/lib/tap-redis.js +1 -118
  27. package/lib/tap-stdout.d.ts +0 -1
  28. package/lib/tap-stdout.js +2 -71
  29. package/package.json +2 -2
  30. package/register.d.ts +0 -1
  31. package/register.js +1 -14
  32. package/index.d.ts.map +0 -1
  33. package/lib/emit.d.ts.map +0 -1
  34. package/lib/flood-guard.d.ts.map +0 -1
  35. package/lib/flow-context.d.ts.map +0 -1
  36. package/lib/install.d.ts.map +0 -1
  37. package/lib/require-hook.d.ts.map +0 -1
  38. package/lib/tap-bullmq.d.ts.map +0 -1
  39. package/lib/tap-egress.d.ts.map +0 -1
  40. package/lib/tap-exec.d.ts.map +0 -1
  41. package/lib/tap-fs.d.ts.map +0 -1
  42. package/lib/tap-nest.d.ts.map +0 -1
  43. package/lib/tap-pg.d.ts.map +0 -1
  44. package/lib/tap-redis.d.ts.map +0 -1
  45. package/lib/tap-stdout.d.ts.map +0 -1
  46. package/register.d.ts.map +0 -1
package/lib/tap-stdout.js CHANGED
@@ -1,71 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tapStdout = tapStdout;
4
- /**
5
- * stdout/stderr tap — the service's ACTUAL log output (the Nest `Logger`,
6
- * `console`, raw writes — exactly what shows in the pod terminal) mirrored into
7
- * the lens as `runtime` log events, so it surfaces in the dashboard Logs view.
8
- *
9
- * The original write still runs (terminal output is unchanged), and `[lensmcp]`
10
- * lines are skipped so the lens never feeds on its own chatter. The emit path is
11
- * fs-tap-safe (lensLog binds the pristine appendFileSync + sets `isLensWriting`),
12
- * so a log line can never recurse into instrumentation. Disable with LENSMCP_LOGS=0.
13
- */
14
- const emit_1 = require("./emit");
15
- // Strip ANSI SGR colour codes (Nest's colourised ConsoleLogger). Build the ESC
16
- // byte at runtime so there's no control character literal in source.
17
- const ANSI = new RegExp(String.fromCharCode(27) + '\\[[0-9;]*m', 'g');
18
- /** Best-effort level from a Nest-formatted line; falls back to the stream default. */
19
- function severityOf(line, fallback) {
20
- if (/\bFATAL\b/.test(line))
21
- return 'fatal';
22
- if (/\bERROR\b/.test(line))
23
- return 'error';
24
- if (/\bWARN\b/.test(line))
25
- return 'warning';
26
- if (/\bDEBUG\b/.test(line) || /\bVERBOSE\b/.test(line))
27
- return 'debug';
28
- if (/\bLOG\b/.test(line))
29
- return 'info';
30
- return fallback;
31
- }
32
- function emitChunk(s, fallback) {
33
- for (const rawLine of s.split('\n')) {
34
- const line = rawLine.replace(ANSI, '').replace(/\s+$/, '');
35
- if (!line.trim())
36
- continue;
37
- (0, emit_1.lensLog)(severityOf(line, fallback), line);
38
- }
39
- }
40
- function tapStdout() {
41
- if (process.env['LENSMCP_LOGS'] === '0')
42
- return;
43
- // Only tap ACTUAL service pods (APP_RUNNER=1) — never the gateway/devserver parent,
44
- // whose high-volume proxy logging would swamp the bus with synchronous appends.
45
- if (process.env['APP_RUNNER'] !== '1')
46
- return;
47
- const targets = [
48
- [process.stdout, 'info'],
49
- [process.stderr, 'error'],
50
- ];
51
- for (const [stream, fallback] of targets) {
52
- if (stream.write.__lensmcp)
53
- continue;
54
- const orig = stream.write.bind(stream);
55
- const wrapped = function (chunk, ...args) {
56
- try {
57
- if (!(0, emit_1.isLensWriting)()) {
58
- const s = typeof chunk === 'string' ? chunk : Buffer.isBuffer(chunk) ? chunk.toString('utf8') : '';
59
- if (s && s.indexOf('[lensmcp]') === -1)
60
- emitChunk(s, fallback);
61
- }
62
- }
63
- catch {
64
- /* never break the host's stdout */
65
- }
66
- return orig(chunk, ...args);
67
- };
68
- wrapped.__lensmcp = true;
69
- stream.write = wrapped;
70
- }
71
- }
1
+ "use strict";var b=Object.defineProperty;var o=(e,t)=>b(e,"name",{value:t,configurable:!0});var u=Object.defineProperty,s=o((e,t)=>u(e,"name",{value:t,configurable:!0}),"s");Object.defineProperty(exports,"__esModule",{value:!0}),exports.tapStdout=tapStdout;const emit_1=require("./emit"),ANSI=new RegExp("\x1B\\[[0-9;]*m","g");function severityOf(e,t){return/\bFATAL\b/.test(e)?"fatal":/\bERROR\b/.test(e)?"error":/\bWARN\b/.test(e)?"warning":/\bDEBUG\b/.test(e)||/\bVERBOSE\b/.test(e)?"debug":/\bLOG\b/.test(e)?"info":t}o(severityOf,"severityOf"),s(severityOf,"severityOf");function emitChunk(e,t){for(const i of e.split(`
2
+ `)){const r=i.replace(ANSI,"").replace(/\s+$/,"");r.trim()&&(0,emit_1.lensLog)(severityOf(r,t),r)}}o(emitChunk,"emitChunk"),s(emitChunk,"emitChunk");function tapStdout(){if(process.env.LENSMCP_LOGS==="0"||process.env.APP_RUNNER!=="1")return;const e=[[process.stdout,"info"],[process.stderr,"error"]];for(const[t,i]of e){if(t.write.__lensmcp)continue;const r=t.write.bind(t),f=s(function(n,...p){try{if(!(0,emit_1.isLensWriting)()){const c=typeof n=="string"?n:Buffer.isBuffer(n)?n.toString("utf8"):"";c&&c.indexOf("[lensmcp]")===-1&&emitChunk(c,i)}}catch{}return r(n,...p)},"wrapped");f.__lensmcp=!0,t.write=f}}o(tapStdout,"tapStdout"),s(tapStdout,"tapStdout");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/node-instrumentation",
3
- "version": "1.18.3",
3
+ "version": "1.18.6",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -15,7 +15,7 @@
15
15
  }
16
16
  },
17
17
  "dependencies": {
18
- "@lensmcp/nest-instrumentation": "1.18.3",
18
+ "@lensmcp/nest-instrumentation": "1.18.6",
19
19
  "tslib": "^2.3.0"
20
20
  },
21
21
  "optionalDependencies": {
package/register.d.ts CHANGED
@@ -8,4 +8,3 @@
8
8
  */
9
9
  import { installLensmcpNodeInstrumentation } from './lib/install';
10
10
  export { installLensmcpNodeInstrumentation };
11
- //# sourceMappingURL=register.d.ts.map
package/register.js CHANGED
@@ -1,14 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installLensmcpNodeInstrumentation = void 0;
4
- /**
5
- * @lensmcp/node-instrumentation/register — the zero-touch entry.
6
- *
7
- * Loaded by the RUNNER (the cluster devserver child, a worker fork's
8
- * `--require`), never imported by host source. Requiring this module IS the
9
- * installation — it must run before the app bundle so the require hook sees
10
- * every external (`pg`, `ioredis`, `bullmq`, `@nestjs/core`) on first load.
11
- */
12
- const install_1 = require("./lib/install");
13
- Object.defineProperty(exports, "installLensmcpNodeInstrumentation", { enumerable: true, get: function () { return install_1.installLensmcpNodeInstrumentation; } });
14
- (0, install_1.installLensmcpNodeInstrumentation)();
1
+ "use strict";var i=Object.defineProperty;var r=(t,n)=>i(t,"name",{value:n,configurable:!0});var s=Object.defineProperty,e=r((t,n)=>s(t,"name",{value:n,configurable:!0}),"e");Object.defineProperty(exports,"__esModule",{value:!0}),exports.installLensmcpNodeInstrumentation=void 0;const install_1=require("./lib/install");Object.defineProperty(exports,"installLensmcpNodeInstrumentation",{enumerable:!0,get:e(function(){return install_1.installLensmcpNodeInstrumentation},"get")}),(0,install_1.installLensmcpNodeInstrumentation)();
package/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClI,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC"}
package/lib/emit.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"emit.d.ts","sourceRo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lib/flood-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,OAAO,CAAC;IACZ,oFAAoF;IACpF,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAmBD,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,iBAAiB,GAAG,UAAU,CA0C1E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"flow-context.d.ts","sourceRoot":"","sources":["../../src/lib/flow-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,UAAU,OAAO;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAMD,wBAAgB,gBAAgB,IAAI,IAAI,CASvC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,GAAG,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAC3C,EAAE,EAAE,MAAM,CAAC,GACV,CAAC,CAOH;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,OAAO,GAAG,SAAS,CAMrD;AAED,kFAAkF;AAClF,wBAAgB,WAAW,IAAI,OAAO,GAAG,SAAS,CAQjD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/lib/install.ts"],"names":[],"mappings":"AAqBA,wBAAgB,iCAAiC,IAAI,IAAI,CAoBxD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"require-hook.d.ts","sourceRoot":"","sources":["../../src/lib/require-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,aAAa,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,CAAC;AAanE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CA2BxE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap-bullmq.d.ts","sourceRoot":"","sources":["../../src/lib/tap-bullmq.ts"],"names":[],"mappings":"AAoDA,wBAAgB,SAAS,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAczD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap-egress.d.ts","sourceRoot":"","sources":["../../src/lib/tap-egress.ts"],"names":[],"mappings":"AA0BA,wBAAgB,SAAS,IAAI,IAAI,CAIhC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap-exec.d.ts","sourceRoot":"","sources":["../../src/lib/tap-exec.ts"],"names":[],"mappings":"AA4DA,wBAAgB,OAAO,IAAI,IAAI,CA4D9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap-fs.d.ts","sourceRoot":"","sources":["../../src/lib/tap-fs.ts"],"names":[],"mappings":"AA6FA,wBAAgB,KAAK,IAAI,IAAI,CA6E5B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap-nest.d.ts","sourceRoot":"","sources":["../../src/lib/tap-nest.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACzC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAwCD;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAM5C;AAED,wBAAgB,OAAO,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAiDvD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap-pg.d.ts","sourceRoot":"","sources":["../../src/lib/tap-pg.ts"],"names":[],"mappings":"AAqDA,wBAAgB,KAAK,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAuErD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap-redis.d.ts","sourceRoot":"","sources":["../../src/lib/tap-redis.ts"],"names":[],"mappings":"AAyCA,wBAAgB,QAAQ,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAoBxD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tap-stdout.d.ts","sourceRoot":"","sources":["../../src/lib/tap-stdout.ts"],"names":[],"mappings":"AAuCA,wBAAgB,SAAS,IAAI,IAAI,CA0BhC"}
package/register.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAIlE,OAAO,EAAE,iCAAiC,EAAE,CAAC"}