@reqray/transport-http 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 +51 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,58 @@
|
|
|
1
1
|
# @reqray/transport-http
|
|
2
2
|
|
|
3
|
-
Reqray
|
|
3
|
+
Ships Reqray's request records from an application to a collector
|
|
4
|
+
([`@reqray/server`](https://www.npmjs.com/package/@reqray/server)) in batches,
|
|
5
|
+
without ever blocking the application.
|
|
4
6
|
|
|
5
|
-
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request inspector for Node.js. It
|
|
8
|
+
instruments HTTP, SQL, outgoing calls and cache on its own, shows every
|
|
9
|
+
request as a waterfall, and finds N+1 down to the file and the line.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Use
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @reqray/transport-http
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { httpTransport } from '@reqray/transport-http';
|
|
19
|
+
|
|
20
|
+
await app.register(reqray, {
|
|
21
|
+
enabled: true,
|
|
22
|
+
mode: 'production',
|
|
23
|
+
panel: false, // the panel lives on the collector
|
|
24
|
+
transport: httpTransport({
|
|
25
|
+
url: 'http://reqray-collector:4300',
|
|
26
|
+
token: process.env.REQRAY_TOKEN,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What it promises
|
|
32
|
+
|
|
33
|
+
- **The queue is bounded**, by count and by size. On overflow the oldest
|
|
34
|
+
records are dropped — memory does not grow because a collector is down.
|
|
35
|
+
- **An unreachable collector is a warning in the log** and retries with
|
|
36
|
+
exponential backoff, up to 30 seconds apart.
|
|
37
|
+
- **`429` is honoured**: the transport waits as long as `Retry-After` says.
|
|
38
|
+
|
|
39
|
+
## Options
|
|
40
|
+
|
|
41
|
+
| Option | Default | |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `url` | required | The collector's address |
|
|
44
|
+
| `token` | none | Sent with every batch |
|
|
45
|
+
| `batchSize` | `50` | Records per request |
|
|
46
|
+
| `flushIntervalMs` | `2000` | How often a partial batch is sent |
|
|
47
|
+
| `maxQueue` | `1000` | Records held while the collector is away |
|
|
48
|
+
| `maxQueueBytes` | 8 MB | …and their total size |
|
|
49
|
+
| `timeoutMs` | `10000` | Per request to the collector |
|
|
50
|
+
| `retryDelayMs` | `1000` | First retry delay; doubles from there |
|
|
51
|
+
|
|
52
|
+
## More
|
|
53
|
+
|
|
54
|
+
Everything else — the detectors, security defaults, measured overhead and a
|
|
55
|
+
demo that runs with one command — is in the
|
|
10
56
|
[main README](https://github.com/reqray/reqray#readme).
|
|
11
57
|
|
|
12
58
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reqray/transport-http",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Reqray HTTP transport: batches with backpressure to an external collector.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@reqray/core": "^0.1.
|
|
52
|
-
"@reqray/protocol": "^0.1.
|
|
51
|
+
"@reqray/core": "^0.1.1",
|
|
52
|
+
"@reqray/protocol": "^0.1.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^26.2.0",
|