@reqray/server 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 +63 -5
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,12 +1,70 @@
|
|
|
1
1
|
# @reqray/server
|
|
2
2
|
|
|
3
|
-
Reqray collector:
|
|
3
|
+
The Reqray collector: a separate process that receives request records from
|
|
4
|
+
your applications, stores them, and serves the panel. This is how Reqray runs
|
|
5
|
+
anywhere the application is reachable from outside — the application only
|
|
6
|
+
ships batches, and the data and the panel live here.
|
|
4
7
|
|
|
5
|
-
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
Part of [Reqray](https://github.com/reqray/reqray) — a dev panel and request inspector for Node.js. It
|
|
9
|
+
instruments HTTP, SQL, outgoing calls and cache on its own, shows every
|
|
10
|
+
request as a waterfall, and finds N+1 down to the file and the line.
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
## Run
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
REQRAY_TOKEN=change-me HOST=0.0.0.0 npx @reqray/server
|
|
16
|
+
# panel: http://<host>:4300/auth?token=change-me
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
| Variable | Default | |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| `PORT` | `4300` | |
|
|
22
|
+
| `HOST` | `127.0.0.1` | Anything else requires a token |
|
|
23
|
+
| `REQRAY_TOKEN` | none | Applications send it with their batches; people sign in at `/auth?token=…` |
|
|
24
|
+
| `REQRAY_DB` | none (memory) | Path to a SQLite file — a history that survives a restart |
|
|
25
|
+
| `REQRAY_LOG` | none | Directory for a log on disk, one JSON line per request, a file per day |
|
|
26
|
+
| `REQRAY_DAYS` | none | How many days the store and the log keep |
|
|
27
|
+
| `BUFFER_SIZE` | `2000` | Requests kept in memory when there is no `REQRAY_DB` |
|
|
28
|
+
|
|
29
|
+
Without a token the collector refuses to listen on anything but loopback: the
|
|
30
|
+
panel shows request bodies and SQL.
|
|
31
|
+
|
|
32
|
+
Node 22.5 or newer — SQLite is built in from there, and nothing is compiled at
|
|
33
|
+
install time.
|
|
34
|
+
|
|
35
|
+
## Point an application at it
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import { httpTransport } from '@reqray/transport-http';
|
|
39
|
+
|
|
40
|
+
await app.register(reqray, {
|
|
41
|
+
enabled: true,
|
|
42
|
+
mode: 'production',
|
|
43
|
+
panel: false, // the panel lives on the collector
|
|
44
|
+
transport: httpTransport({
|
|
45
|
+
url: 'http://reqray-collector:4300',
|
|
46
|
+
token: process.env.REQRAY_TOKEN,
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Under load the collector answers `429` with `Retry-After` rather than queueing
|
|
52
|
+
without bound, and the transport backs off.
|
|
53
|
+
|
|
54
|
+
## From code
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
import { createReqrayServer } from '@reqray/server';
|
|
58
|
+
|
|
59
|
+
const server = await createReqrayServer({ port: 4300, token: process.env.REQRAY_TOKEN });
|
|
60
|
+
console.log(server.url);
|
|
61
|
+
await server.close();
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## More
|
|
65
|
+
|
|
66
|
+
Everything else — the detectors, security defaults, measured overhead and a
|
|
67
|
+
demo that runs with one command — is in the
|
|
10
68
|
[main README](https://github.com/reqray/reqray#readme).
|
|
11
69
|
|
|
12
70
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reqray/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Reqray collector: batch ingestion from applications, storage, and the dashboard.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@reqray/core": "^0.1.
|
|
55
|
-
"@reqray/
|
|
56
|
-
"@reqray/
|
|
57
|
-
"@reqray/
|
|
58
|
-
"@reqray/
|
|
54
|
+
"@reqray/core": "^0.1.1",
|
|
55
|
+
"@reqray/dashboard": "^0.1.1",
|
|
56
|
+
"@reqray/transport-file": "^0.1.1",
|
|
57
|
+
"@reqray/store-memory": "^0.1.1",
|
|
58
|
+
"@reqray/store-sqlite": "^0.1.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/node": "^26.2.0",
|
|
62
62
|
"tsup": "^8.5.1",
|
|
63
63
|
"typescript": "^6.0.3",
|
|
64
|
-
"@reqray/transport-http": "^0.1.
|
|
64
|
+
"@reqray/transport-http": "^0.1.1"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsup",
|