@reqray/transport-file 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 +47 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,12 +1,54 @@
1
1
  # @reqray/transport-file
2
2
 
3
- Reqray request log: every recorded request as a line of JSON, rotated by day and swept by the retention policy.
3
+ Reqray's request log on disk: every recorded request as one line of JSON, a
4
+ file per day. A database is what the panel reads; this is what `grep` reads,
5
+ what `tail -f` follows and what a log shipper picks up.
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
+ 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
- Documentation, screenshots and a demo that runs with one command are in the
11
+ ## Use
12
+
13
+ ```bash
14
+ npm install @reqray/transport-file
15
+ ```
16
+
17
+ ```js
18
+ import { fileTransport, retentionPolicy } from '@reqray/transport-file';
19
+ import { sqliteTransport } from '@reqray/store-sqlite';
20
+
21
+ const retention = retentionPolicy({ days: 7, file: '.reqray/retention.json' });
22
+
23
+ await app.register(reqray, {
24
+ retention,
25
+ transport: [
26
+ sqliteTransport({ file: '.reqray/requests.db', retention }),
27
+ fileTransport({ dir: '.reqray/log', retention }),
28
+ ],
29
+ });
30
+ ```
31
+
32
+ Writing is streamed and never on the request path. A write that fails takes
33
+ the log down and nothing else; a log that falls behind the application drops
34
+ lines and counts them rather than growing the heap.
35
+
36
+ ## Options
37
+
38
+ | Option | Default | |
39
+ |---|---|---|
40
+ | `dir` | required | Directory the daily files go to |
41
+ | `retention` | none | A shared `retentionPolicy`, so the log and the store evict by one number |
42
+ | `days` | none | How many days of files to keep, when no shared policy is given |
43
+ | `maxBytes` | none | Total size of the log on disk |
44
+
45
+ On the collector it is two variables: `REQRAY_LOG=/var/lib/reqray/log` and
46
+ `REQRAY_DAYS=7`.
47
+
48
+ ## More
49
+
50
+ Everything else — the detectors, security defaults, measured overhead and a
51
+ demo that runs with one command — is in the
10
52
  [main README](https://github.com/reqray/reqray#readme).
11
53
 
12
54
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqray/transport-file",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Reqray request log: every recorded request as a line of JSON, rotated by day and swept by the retention policy.",
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.0",
52
- "@reqray/protocol": "^0.1.0"
51
+ "@reqray/core": "^0.1.1",
52
+ "@reqray/protocol": "^0.1.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/node": "^26.2.0",