@reqray/instrumentation-undici 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.
- package/README.md +45 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,12 +1,52 @@
|
|
|
1
1
|
# @reqray/instrumentation-undici
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Records outgoing HTTP calls — undici and the built-in `fetch` — into the request that made them, through Node's own `diagnostics_channel`. Nothing is patched.
|
|
4
4
|
|
|
5
|
-
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request inspector for Node.js. It
|
|
6
|
+
instruments HTTP, SQL, outgoing calls and cache on its own, shows every
|
|
7
|
+
request as a waterfall, and finds N+1 down to the file and the line.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## You probably do not need to install this
|
|
10
|
+
|
|
11
|
+
[`@reqray/register`](https://www.npmjs.com/package/@reqray/register) depends on
|
|
12
|
+
it and applies it automatically:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
node --import @reqray/register app.js
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
reqray instrumentation active
|
|
20
|
+
✔ undici (built-in) outgoing HTTP
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## What is recorded
|
|
24
|
+
|
|
25
|
+
For each call: method, URL, status and duration. That is what lets Reqray flag calls made one after another that could have run in parallel, and the same URL fetched twice.
|
|
26
|
+
|
|
27
|
+
**Secrets in the URL are masked** before anything is stored: `?token=abc` becomes `?token=[redacted]`. Request and response bodies of outgoing calls are not recorded.
|
|
28
|
+
|
|
29
|
+
Supported: any undici, and the `fetch` built into Node 20 or newer. Outside that range nothing is patched, and the startup
|
|
30
|
+
report says so.
|
|
31
|
+
|
|
32
|
+
## Applying it by hand
|
|
33
|
+
|
|
34
|
+
In a bundled application (esbuild, webpack, tsup) imports are resolved at build
|
|
35
|
+
time and loader hooks never fire. Apply the instrumentation yourself, before
|
|
36
|
+
the first call:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import { instrumentUndici } from '@reqray/instrumentation-undici';
|
|
40
|
+
|
|
41
|
+
instrumentUndici().apply();
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
No version range is checked on this path — the choice was yours.
|
|
45
|
+
|
|
46
|
+
## More
|
|
47
|
+
|
|
48
|
+
Everything else — the detectors, security defaults, measured overhead and a
|
|
49
|
+
demo that runs with one command — is in the
|
|
10
50
|
[main README](https://github.com/reqray/reqray#readme).
|
|
11
51
|
|
|
12
52
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reqray/instrumentation-undici",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Outgoing HTTP instrumentation (undici / built-in fetch) for Reqray.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@reqray/core": "^0.1.
|
|
51
|
+
"@reqray/core": "^0.1.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^26.2.0",
|