@reqray/register 0.1.0 → 0.1.1

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 (2) hide show
  1. package/README.md +65 -5
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -1,12 +1,72 @@
1
1
  # @reqray/register
2
2
 
3
- Loader hooks (CJS + ESM) for automatic Reqray instrumentation.
3
+ One flag on the command line, and a Node.js application's requests show up in
4
+ a panel as waterfalls — SQL, outgoing HTTP, cache — with N+1 queries pointed at
5
+ the file and the line. No code changes.
4
6
 
5
- Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request-inspection tool for
6
- Node.js. It instruments HTTP, SQL, outgoing calls and cache on its own, shows
7
- every request as a waterfall, and finds N+1 down to the file and the line.
7
+ ![A request arrives, is flagged N+1, and one click shows the line and the fix](https://raw.githubusercontent.com/reqray/reqray/main/docs/screenshots/00-demo.gif)
8
8
 
9
- Documentation, screenshots and a demo that runs with one command are in the
9
+ ## Use
10
+
11
+ ```bash
12
+ npm install -D @reqray/register
13
+ node --import @reqray/register app.js
14
+ ```
15
+
16
+ ```
17
+ reqray instrumentation active
18
+ ✔ pg@8.23.0 SQL
19
+ ✔ ioredis@5.11.1 cache
20
+ ✔ undici (built-in) outgoing HTTP
21
+ reqray: no adapter found — panel is up at http://127.0.0.1:4310/_reqray/
22
+ ```
23
+
24
+ Works for ESM and CommonJS applications. A CommonJS application can also be
25
+ started with `node --require @reqray/register app.js`.
26
+
27
+ ## What it does
28
+
29
+ It installs loader hooks before your application loads its drivers, and
30
+ instruments them as they are imported:
31
+
32
+ | | Supported | Recorded |
33
+ |---|---|---|
34
+ | `pg` (and Prisma 7, which goes through it) | 8.x | the statement, its duration, the line that issued it — never parameter values |
35
+ | `ioredis` | 5.x | the command, the key, hit or miss — never values |
36
+ | undici and the built-in `fetch` | any | method, URL with secrets masked, status, duration |
37
+ | incoming `node:http` | any | used only when no adapter is present |
38
+
39
+ A driver outside its supported range is not patched; the startup report says
40
+ so and names the range.
41
+
42
+ ## With an adapter
43
+
44
+ Without an adapter the panel runs on a port of its own and records what
45
+ `node:http` can see. Request bodies, route names and replay need the framework's
46
+ cooperation — add [`@reqray/fastify`](https://www.npmjs.com/package/@reqray/fastify),
47
+ [`@reqray/express`](https://www.npmjs.com/package/@reqray/express) or
48
+ [`@reqray/nestjs`](https://www.npmjs.com/package/@reqray/nestjs), and the panel
49
+ moves into the application at `/_reqray/`.
50
+
51
+ ## Settings
52
+
53
+ | Variable | Default | |
54
+ |---|---|---|
55
+ | `REQRAY_PANEL_PORT` | `4310` | Port of the standalone panel |
56
+ | `REQRAY_STANDALONE` | on | `off` — instrument drivers, but start no panel of its own |
57
+
58
+ ## Limits
59
+
60
+ - The flag has to be there. Hooks installed after a driver has loaded cannot
61
+ reach it, and the startup report tells you when that happened.
62
+ - Bundled applications (esbuild, webpack, tsup) resolve imports at build time,
63
+ so loader hooks never fire. Apply an instrumentation by hand instead:
64
+ `instrumentPg().apply(pg)` from `@reqray/instrumentation-pg`.
65
+
66
+ ## More
67
+
68
+ Everything else — the detectors, security defaults, measured overhead and a
69
+ demo that runs with one command — is in the
10
70
  [main README](https://github.com/reqray/reqray#readme).
11
71
 
12
72
  ## License
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reqray/register",
3
- "version": "0.1.0",
4
- "description": "Loader hooks (CJS + ESM) for automatic Reqray instrumentation.",
3
+ "version": "0.1.1",
4
+ "description": "Start with `node --import @reqray/register` and a Node.js app's requests become waterfalls: SQL, cache and outgoing HTTP instrumented automatically, N+1 found down to the line.",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "nodejs",
@@ -51,12 +51,12 @@
51
51
  "import-in-the-middle": "^3.3.3",
52
52
  "require-in-the-middle": "^8.0.1",
53
53
  "semver": "^7.8.5",
54
- "@reqray/instrumentation-ioredis": "^0.1.0",
55
- "@reqray/dashboard": "^0.1.0",
56
- "@reqray/core": "^0.1.0",
57
- "@reqray/instrumentation-undici": "^0.1.0",
58
- "@reqray/instrumentation-pg": "^0.1.0",
59
- "@reqray/store-memory": "^0.1.0"
54
+ "@reqray/core": "^0.1.1",
55
+ "@reqray/instrumentation-pg": "^0.1.1",
56
+ "@reqray/instrumentation-ioredis": "^0.1.1",
57
+ "@reqray/store-memory": "^0.1.1",
58
+ "@reqray/dashboard": "^0.1.1",
59
+ "@reqray/instrumentation-undici": "^0.1.1"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "^26.2.0",