@reqray/instrumentation-pg 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 +49 -5
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,12 +1,56 @@
1
1
  # @reqray/instrumentation-pg
2
2
 
3
- pg driver instrumentation for Reqray.
3
+ Records every query made through `pg` (node-postgres) into the request that issued it — and therefore every query made by Prisma 7, which goes through node-postgres.
4
4
 
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.
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
- Documentation, screenshots and a demo that runs with one command are in the
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
+ ✔ pg@8.23.0 SQL
21
+ ```
22
+
23
+ ## What is recorded
24
+
25
+ For each query: the statement, its duration, the number of rows, the line of your code that issued it, and — when the query had to wait for a pooled connection — how long it waited. Statements are normalized into a fingerprint, which is what the N+1 detector counts.
26
+
27
+ **Parameter values are not recorded**, in any mode. `collectSqlValues: true` is an explicit opt-in for local debugging.
28
+
29
+ Supported: `pg` 8.x. 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 pg from 'pg';
40
+ import { instrumentPg } from '@reqray/instrumentation-pg';
41
+
42
+ instrumentPg().apply(pg);
43
+ ```
44
+
45
+ No version range is checked on this path — the choice was yours.
46
+
47
+ Callback and promise styles are both supported, and a driver error reaches
48
+ your code unchanged.
49
+
50
+ ## More
51
+
52
+ Everything else — the detectors, security defaults, measured overhead and a
53
+ demo that runs with one command — is in the
10
54
  [main README](https://github.com/reqray/reqray#readme).
11
55
 
12
56
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqray/instrumentation-pg",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "pg driver instrumentation 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.0"
51
+ "@reqray/core": "^0.1.1"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "pg": ">=8 <9"