@tracepanel/js 0.5.0 → 0.7.0
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 +265 -14
- package/dist/agent.d.ts +5 -1
- package/dist/agent.js +12 -3
- package/dist/agent.js.map +1 -1
- package/dist/aws.d.ts +27 -0
- package/dist/aws.js +368 -0
- package/dist/aws.js.map +1 -0
- package/dist/browser.d.ts +4 -1
- package/dist/browser.js +33 -3
- package/dist/browser.js.map +1 -1
- package/dist/bun.js +6 -82
- package/dist/bun.js.map +1 -1
- package/dist/calls.d.ts +5 -0
- package/dist/calls.js +7 -0
- package/dist/calls.js.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/explain.d.ts +5 -0
- package/dist/explain.js +56 -7
- package/dist/explain.js.map +1 -1
- package/dist/express.js +43 -3
- package/dist/express.js.map +1 -1
- package/dist/fastify.d.ts +2 -0
- package/dist/fastify.js +100 -0
- package/dist/fastify.js.map +1 -0
- package/dist/frameworks.js +3 -0
- package/dist/frameworks.js.map +1 -1
- package/dist/graphql.d.ts +39 -0
- package/dist/graphql.js +337 -0
- package/dist/graphql.js.map +1 -0
- package/dist/hono.d.ts +2 -0
- package/dist/hono.js +63 -0
- package/dist/hono.js.map +1 -0
- package/dist/koa.d.ts +2 -0
- package/dist/koa.js +119 -0
- package/dist/koa.js.map +1 -0
- package/dist/llm.d.ts +20 -0
- package/dist/llm.js +632 -0
- package/dist/llm.js.map +1 -0
- package/dist/memory.d.ts +69 -0
- package/dist/memory.js +203 -0
- package/dist/memory.js.map +1 -0
- package/dist/model.d.ts +22 -1
- package/dist/model.js.map +1 -1
- package/dist/next.js +4 -4
- package/dist/next.js.map +1 -1
- package/dist/processor.d.ts +50 -5
- package/dist/processor.js +193 -30
- package/dist/processor.js.map +1 -1
- package/dist/profile.d.ts +34 -8
- package/dist/profile.js +98 -13
- package/dist/profile.js.map +1 -1
- package/dist/propagation.d.ts +12 -0
- package/dist/propagation.js +48 -0
- package/dist/propagation.js.map +1 -0
- package/dist/queries.d.ts +20 -0
- package/dist/queries.js +75 -0
- package/dist/queries.js.map +1 -0
- package/dist/respond.d.ts +12 -0
- package/dist/respond.js +85 -0
- package/dist/respond.js.map +1 -0
- package/dist/setup.js +27 -6
- package/dist/setup.js.map +1 -1
- package/dist/sql.d.ts +1 -0
- package/dist/sql.js +11 -2
- package/dist/sql.js.map +1 -1
- package/dist/sqlite.d.ts +13 -0
- package/dist/sqlite.js +291 -0
- package/dist/sqlite.js.map +1 -0
- package/dist/stack.d.ts +3 -1
- package/dist/stack.js +30 -6
- package/dist/stack.js.map +1 -1
- package/dist/testing.d.ts +128 -0
- package/dist/testing.js +362 -0
- package/dist/testing.js.map +1 -0
- package/dist/transactions.d.ts +11 -1
- package/dist/transactions.js +70 -34
- package/dist/transactions.js.map +1 -1
- package/dist/view.d.ts +17 -0
- package/dist/view.js +71 -0
- package/dist/view.js.map +1 -0
- package/dist/vitest-setup.d.ts +1 -0
- package/dist/vitest-setup.js +63 -0
- package/dist/vitest-setup.js.map +1 -0
- package/dist/vitest.d.ts +57 -0
- package/dist/vitest.js +130 -0
- package/dist/vitest.js.map +1 -0
- package/dist/widget.d.ts +16 -0
- package/dist/widget.js +42 -1
- package/dist/widget.js.map +1 -1
- package/package.json +81 -4
package/README.md
CHANGED
|
@@ -4,20 +4,51 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@tracepanel/js)
|
|
5
5
|
[](https://www.npmjs.com/package/@tracepanel/js)
|
|
6
6
|
|
|
7
|
-
**See what your app
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
console.
|
|
7
|
+
**See what your Node.js or Bun app is really doing.** Tracepanel records each
|
|
8
|
+
request and background job of your app with its SQL queries, Redis and
|
|
9
|
+
MongoDB commands, outgoing HTTP calls, logs and errors. It points out N+1
|
|
10
|
+
queries and calls, duplicates, slow SQL and slow HTTP calls, and names the
|
|
11
|
+
line of code to fix. You read it in a panel on your pages and in a console.
|
|
12
12
|
|
|
13
13
|
It runs while you develop, and everything stays on your machine.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
[](https://tracepanel.dev/video/demo-js.mp4)
|
|
16
|
+
|
|
17
|
+
▶ [Watch the 40-second demo](https://tracepanel.dev/video/demo-js.mp4)
|
|
18
|
+
|
|
19
|
+
## Works with
|
|
20
|
+
|
|
21
|
+
| | Supported |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| **Runtimes** | Node.js 20.19 and later, tested in CI on 20.19, 22, 24 and 26. Bun. |
|
|
24
|
+
| **Frameworks** | Express 4.18 and later, Fastify 5, Koa 3 with `@koa/router`, Hono 4.8 and later on Node and on Bun, NestJS on Express, Next.js in its Node.js runtime, Nuxt, and `Bun.serve`. On Bun also any fetch handler, such as Elysia's. Any other server on Node's `node:http` at the request level. |
|
|
25
|
+
| **GraphQL** | GraphQL Yoga and Apollo Server, through their plugins: each request named after its operation, the app's resolvers as steps with their calls under them, resolver errors behind HTTP 200. |
|
|
26
|
+
| **Databases** | `pg` and `mysql2`, and so Drizzle, Knex, Sequelize, TypeORM and Prisma's driver adapters, with Prisma's operations as steps. SQLite through `better-sqlite3`, `node:sqlite` and `libsql`. Transactions and their savepoints. EXPLAIN on PostgreSQL, MySQL and SQLite. |
|
|
27
|
+
| **Redis and MongoDB** | `ioredis` and `redis`, and the MongoDB driver, with their own N+1 and duplicates. |
|
|
28
|
+
| **HTTP clients** | `fetch()`, and `node:http` clients such as axios, on Node and on Bun. |
|
|
29
|
+
| **AWS** | The AWS SDK's v3 clients (`@aws-sdk/client-*`): S3 as storage calls, DynamoDB commands with their N+1 and duplicates, SQS and SNS messages, and every other service's calls, with their errors and retries. |
|
|
30
|
+
| **LLMs** | OpenAI's and Anthropic's SDKs, and the AI SDK's OpenAI and Anthropic providers: each call's model, tokens, cost, time to the first chunk of a stream, and errors. |
|
|
31
|
+
| **Background jobs** | BullMQ: each job a worker runs is a task, each job the app adds a step, and the jobs in flight are listed live. |
|
|
32
|
+
| **Logs** | `console`, pino, winston and Nest's `Logger`, each line on the request or job that wrote it. |
|
|
33
|
+
| **Errors** | Thrown in a handler, with your frames, their source and, on Node, their local variables. |
|
|
34
|
+
| **Profiling** | Where a request's CPU time goes, and on request its memory and garbage collections, on Node. |
|
|
35
|
+
| **Tests** | Vitest 4.1 and later: a test fails when it makes an N+1 or duplicate queries. |
|
|
36
|
+
| **Browser** | The badge and its panel on server-rendered pages, in Next.js through `<Tracepanel />` and in an SPA through the Vite plugin. The pages' views and clicks with their `fetch()` calls, linked to the API's traces. |
|
|
37
|
+
|
|
38
|
+
The settings and what each integration records are in the
|
|
39
|
+
[JavaScript docs](https://tracepanel.dev/docs/javascript).
|
|
40
|
+
|
|
41
|
+
## Install
|
|
16
42
|
|
|
17
43
|
```bash
|
|
18
44
|
npm install @tracepanel/js
|
|
19
45
|
```
|
|
20
46
|
|
|
47
|
+
It brings the agent for your platform, `@tracepanel/agent`, which keeps the
|
|
48
|
+
traces and serves the console.
|
|
49
|
+
|
|
50
|
+
## Setup
|
|
51
|
+
|
|
21
52
|
Tracepanel is on unless `NODE_ENV` is `production`. `TRACEPANEL_ENABLED=0`
|
|
22
53
|
turns it off and `TRACEPANEL_ENABLED=1` turns it on. It starts its agent on
|
|
23
54
|
the first request. The agent keeps the traces in `.tracepanel/` in your
|
|
@@ -62,6 +93,85 @@ await import("./server.js");
|
|
|
62
93
|
|
|
63
94
|
The agent starts by itself either way, on the app's first request.
|
|
64
95
|
|
|
96
|
+
### Fastify
|
|
97
|
+
|
|
98
|
+
Load Tracepanel before the app as for Express, and register the plugin
|
|
99
|
+
before the routes, so it sees each one as it is added:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
node --import @tracepanel/js/register server.js
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
import Fastify from "fastify";
|
|
107
|
+
import { tracepanel } from "@tracepanel/js/fastify";
|
|
108
|
+
|
|
109
|
+
const app = Fastify();
|
|
110
|
+
await app.register(tracepanel());
|
|
111
|
+
app.get("/books/:id", async (request) => findBook(request.params.id));
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Each request is named by its route (`GET /books/:id`), and its handler is a
|
|
115
|
+
step of its own, with the line that added the route. HTML pages get the
|
|
116
|
+
badge, sent whole or streamed. An error Fastify answers with a 500 is the
|
|
117
|
+
request's error, with its local variables; one it answers below 500, such
|
|
118
|
+
as a validation error or a `statusCode: 404`, is the response.
|
|
119
|
+
|
|
120
|
+
### Koa
|
|
121
|
+
|
|
122
|
+
Load Tracepanel before the app as for Express, and add the middleware first:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
node --import @tracepanel/js/register server.js
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
import Koa from "koa";
|
|
130
|
+
import Router from "@koa/router";
|
|
131
|
+
import { tracepanel } from "@tracepanel/js/koa";
|
|
132
|
+
|
|
133
|
+
const app = new Koa();
|
|
134
|
+
app.use(tracepanel());
|
|
135
|
+
const router = new Router();
|
|
136
|
+
router.get("/books/:id", async (ctx) => {
|
|
137
|
+
ctx.body = await findBook(ctx.params.id);
|
|
138
|
+
});
|
|
139
|
+
app.use(router.routes());
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Each `@koa/router` route's handler is a step named by its route, and so is
|
|
143
|
+
the request, nested routers' prefixes included. The badge goes on HTML pages,
|
|
144
|
+
and on the answer Koa gives an error. `ctx.throw(404)` is the response, not
|
|
145
|
+
an error.
|
|
146
|
+
|
|
147
|
+
### Hono
|
|
148
|
+
|
|
149
|
+
On Node, serve the app with `@hono/node-server`, load Tracepanel before it,
|
|
150
|
+
and add the middleware first:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
node --import @tracepanel/js/register server.js
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
import { serve } from "@hono/node-server";
|
|
158
|
+
import { Hono } from "hono";
|
|
159
|
+
import { tracepanel } from "@tracepanel/js/hono";
|
|
160
|
+
|
|
161
|
+
const app = new Hono();
|
|
162
|
+
app.use(tracepanel());
|
|
163
|
+
app.get("/books/:id", async (c) => c.json(await findBook(c.req.param("id"))));
|
|
164
|
+
serve({ fetch: app.fetch });
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Each request is named by its route, a sub-app's base path included, and its
|
|
168
|
+
handler is a step of its own. HTML pages get the badge, and the request's
|
|
169
|
+
body goes into its trace as far as the handler read it. An `HTTPException`
|
|
170
|
+
below 500, or what `app.onError` answers below 500, is the response.
|
|
171
|
+
|
|
172
|
+
On Bun, add the same middleware and serve the app with `serve()` from
|
|
173
|
+
`@tracepanel/js/bun` (see Bun below), which puts the badge on the response.
|
|
174
|
+
|
|
65
175
|
### NestJS
|
|
66
176
|
|
|
67
177
|
Nest runs on Express: load Tracepanel the same way and add the same
|
|
@@ -84,6 +194,38 @@ app.use(tracepanel());
|
|
|
84
194
|
await app.listen(3000);
|
|
85
195
|
```
|
|
86
196
|
|
|
197
|
+
### GraphQL
|
|
198
|
+
|
|
199
|
+
Add the plugin of your GraphQL server; load Tracepanel and its framework's
|
|
200
|
+
middleware as above. GraphQL Yoga, on Express or any other server:
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
import { createYoga } from "graphql-yoga";
|
|
204
|
+
import { tracepanelYogaPlugin } from "@tracepanel/js/graphql";
|
|
205
|
+
|
|
206
|
+
const yoga = createYoga({ schema, plugins: [tracepanelYogaPlugin()] });
|
|
207
|
+
app.use(yoga.graphqlEndpoint, yoga);
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Apollo Server:
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
import { ApolloServer } from "@apollo/server";
|
|
214
|
+
import { tracepanelApolloPlugin } from "@tracepanel/js/graphql";
|
|
215
|
+
|
|
216
|
+
const server = new ApolloServer({ typeDefs, resolvers, plugins: [tracepanelApolloPlugin()] });
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Each request is named after its operation, such as `GraphQL query Books`, so
|
|
220
|
+
traffic groups by operation rather than `POST /graphql`, and the console's
|
|
221
|
+
GraphQL page lists them. The operation is a step with its parse and validate
|
|
222
|
+
phases, and each of your resolvers is a step, such as `Book.author`, with
|
|
223
|
+
the queries and calls it makes under it: an N+1 shows which field runs it.
|
|
224
|
+
Fields without a resolver of their own are left out. An exception a resolver
|
|
225
|
+
throws is the request's error though the client gets it with a 200; a
|
|
226
|
+
`GraphQLError` you answer with, and a client's syntax or validation error,
|
|
227
|
+
are not. The variables are in the request's body, their secrets masked.
|
|
228
|
+
|
|
87
229
|
### Next.js
|
|
88
230
|
|
|
89
231
|
Next.js starts its own server: Tracepanel goes in from the instrumentation
|
|
@@ -155,7 +297,9 @@ badge on server-rendered pages, and records the errors h3 answers with a 500.
|
|
|
155
297
|
### Bun
|
|
156
298
|
|
|
157
299
|
`serve()` is `Bun.serve` with each route traced under its pattern, and
|
|
158
|
-
`withTracepanel()` wraps any fetch handler, such as
|
|
300
|
+
`withTracepanel()` wraps any fetch handler, such as Elysia's `handle`. A Hono
|
|
301
|
+
app is `serve({ fetch: app.fetch })`, with its `tracepanel()` middleware (see
|
|
302
|
+
Hono above) naming its routes:
|
|
159
303
|
|
|
160
304
|
```bash
|
|
161
305
|
bun --preload @tracepanel/js/register server.ts
|
|
@@ -208,8 +352,12 @@ its actions under it, and the badge's panel lists each action over the
|
|
|
208
352
|
requests it made.
|
|
209
353
|
|
|
210
354
|
A call to the page's own origin carries a W3C `traceparent`, so the console
|
|
211
|
-
links it to the API's trace.
|
|
212
|
-
|
|
355
|
+
links it to the API's trace. While the panel's Profile toggle is on, the
|
|
356
|
+
same calls carry `X-Tracepanel-Profile` (`1`, or `memory`), so an API on
|
|
357
|
+
another origin, which never gets the toggle's cookie, profiles the request
|
|
358
|
+
too, and so does each app it calls in turn. `propagateTo` names other
|
|
359
|
+
origins, whose CORS must allow both headers (`cors()` and
|
|
360
|
+
`allow_headers=["*"]` do):
|
|
213
361
|
|
|
214
362
|
```ts
|
|
215
363
|
tracepanel({ dir: "../backend", browser: { service: "shop-web", propagateTo: ["http://127.0.0.1:8000"] } });
|
|
@@ -223,6 +371,21 @@ console on the page's origin (`api`, `/__tracepanel__/` by default).
|
|
|
223
371
|
`ignoreSources` takes the path prefixes of scripts whose console isn't the
|
|
224
372
|
page's, such as a dev server's client.
|
|
225
373
|
|
|
374
|
+
## What it looks like
|
|
375
|
+
|
|
376
|
+
Each request shows its call tree, with the SQL queries, the calls and the
|
|
377
|
+
issues in it. Here a Next.js store on Postgres lists its products from
|
|
378
|
+
Swagger UI, and loads each product's category, brand and rating in a query of
|
|
379
|
+
its own:
|
|
380
|
+
|
|
381
|
+

|
|
382
|
+
|
|
383
|
+
The panel also lists what happened on the page: its view, each click, and the
|
|
384
|
+
requests it made with `fetch()`, here Swagger UI's Execute. Each issue names
|
|
385
|
+
the line that ran it and the fix:
|
|
386
|
+
|
|
387
|
+

|
|
388
|
+
|
|
226
389
|
## What it records
|
|
227
390
|
|
|
228
391
|
- HTTP requests, with the route and the handler that served them, and what
|
|
@@ -250,13 +413,16 @@ page's, such as a dev server's client.
|
|
|
250
413
|
- A form's POST that redirects to another page: the panel on that page
|
|
251
414
|
lists the POST before it.
|
|
252
415
|
- SQL from `pg` and `mysql2` (and so Drizzle, Knex, Sequelize, TypeORM and
|
|
253
|
-
Prisma's driver adapters),
|
|
416
|
+
Prisma's driver adapters), and from SQLite through `better-sqlite3`,
|
|
417
|
+
Node's `node:sqlite` and `libsql`, with the line of your code that ran each
|
|
254
418
|
statement. A statement no code of yours made, such as a session store's,
|
|
255
419
|
names the library code that asked for it, past the driver and the ORM;
|
|
256
420
|
so do Redis and MongoDB commands. Prisma's operations show as steps.
|
|
257
|
-
- Transactions: BEGIN … COMMIT (or ROLLBACK) on a `pg` client
|
|
258
|
-
connection
|
|
259
|
-
savepoints.
|
|
421
|
+
- Transactions: BEGIN … COMMIT (or ROLLBACK) on a `pg` client, a `mysql2`
|
|
422
|
+
connection or a SQLite database, and better-sqlite3's `db.transaction()`,
|
|
423
|
+
with its statements and the calls made inside it, and its savepoints.
|
|
424
|
+
- The console's EXPLAIN of a SQLite query (EXPLAIN QUERY PLAN) runs on the
|
|
425
|
+
app's own connection, so a database in memory has a plan too.
|
|
260
426
|
- Redis commands (`ioredis`, `redis`) and MongoDB commands, with their own
|
|
261
427
|
N+1 and duplicates.
|
|
262
428
|
- Outgoing HTTP calls: `fetch()`, and `node:http` clients such as axios, on
|
|
@@ -280,6 +446,24 @@ page's, such as a dev server's client.
|
|
|
280
446
|
every request at once, so a profile keeps the samples taken while its
|
|
281
447
|
request was the only one running, and counts the rest
|
|
282
448
|
(`tracepanel.dropped_samples`). Time spent waiting on I/O is not in it.
|
|
449
|
+
Every profile counts the garbage collector's runs and their pauses.
|
|
450
|
+
A request profiled because it asked asks the same of the apps it calls:
|
|
451
|
+
each call that carries a `traceparent` (fetch, node:http, axios, got)
|
|
452
|
+
carries `X-Tracepanel-Profile` too, so the panel's toggle profiles the
|
|
453
|
+
whole chain. `TRACEPANEL_PROFILE=1` asks nothing of them: each app's own
|
|
454
|
+
setting decides.
|
|
455
|
+
- A profile's memory too, when asked: `X-Tracepanel-Profile: memory`, the
|
|
456
|
+
`tracepanel_profile=memory` cookie (the panel's Profile toggle offers
|
|
457
|
+
it), or `TRACEPANEL_PROFILE_MEMORY=1`. V8's sampling heap profiler takes
|
|
458
|
+
about one allocation in every 32 KB with its stack: the profile shows the
|
|
459
|
+
heap's peak above where the request started, what V8 allocated in all
|
|
460
|
+
(on Node 26), and the 50 sites whose allocations still lived at its end.
|
|
461
|
+
The heap is the whole process's, so a request that ran beside others says
|
|
462
|
+
so. It costs: code runs about 15% slower while it is sampled, and reading
|
|
463
|
+
the sampler's profile makes V8 collect the whole heap once at the end of
|
|
464
|
+
each such request, after its response, which stops the process for a few
|
|
465
|
+
milliseconds on a small heap and over 100 ms on a heap of a few hundred
|
|
466
|
+
MB. Leave it off when you measure time. Not on Bun.
|
|
283
467
|
- The caller's trace, when a request carries a W3C `traceparent`: the agent
|
|
284
468
|
links the two.
|
|
285
469
|
|
|
@@ -298,6 +482,65 @@ request it is a step. `span()` is a step of the current trace. Outside
|
|
|
298
482
|
development they run the function and nothing else. Run a script with
|
|
299
483
|
`npx tracepanel run node script.js`.
|
|
300
484
|
|
|
485
|
+
## In tests
|
|
486
|
+
|
|
487
|
+
The Vitest plugin turns what Tracepanel finds into test failures, so an N+1
|
|
488
|
+
query fails CI before it reaches production. Add it to the Vitest config:
|
|
489
|
+
|
|
490
|
+
```ts
|
|
491
|
+
// vitest.config.ts
|
|
492
|
+
import { defineConfig } from "vitest/config";
|
|
493
|
+
import { tracepanel } from "@tracepanel/js/vitest";
|
|
494
|
+
|
|
495
|
+
export default defineConfig({
|
|
496
|
+
plugins: [tracepanel()], // or tracepanel({ failOn: ["n+1", "duplicates", "slow-sql"] })
|
|
497
|
+
});
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
Each test runs as a trace named after the test, with its queries in it. A
|
|
501
|
+
request the test makes of a server it started (supertest, `fetch()`) is a
|
|
502
|
+
trace of its own, linked to the test's in the console. Work in `beforeAll` is
|
|
503
|
+
outside every test's trace; `beforeEach` and `afterEach` run inside it.
|
|
504
|
+
|
|
505
|
+
When the test passes, the agent looks at its traces. An issue of a kind in
|
|
506
|
+
`failOn` (`n+1` and `duplicates` by default) fails the test with the issue,
|
|
507
|
+
its query, the line of code that ran it and a link to the trace:
|
|
508
|
+
|
|
509
|
+
```text
|
|
510
|
+
AssertionError: tracepanel found 1 issue in this test:
|
|
511
|
+
|
|
512
|
+
N+1: 4 similar queries · SELECT authors
|
|
513
|
+
SELECT name FROM authors WHERE id = $1
|
|
514
|
+
at src/books.ts:28 in listBooks
|
|
515
|
+
in GET /books → http://127.0.0.1:52068/#/t/01M60NB74Q6T9AXZGMFJ7V8FB1
|
|
516
|
+
Load the related rows with the parent rows (a join, or one batched query) instead of one query per row.
|
|
517
|
+
|
|
518
|
+
The test's trace: http://127.0.0.1:52068/#/t/01M60NB74J4Q5VDHCJD1Z4T1J7
|
|
519
|
+
Allowed here with the test's option { meta: { tracepanel: { allow: ["n+1"] } } }.
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
The `tracepanel` meta changes the rules for a test or a `describe()`, and
|
|
523
|
+
`testTrace()` and `maxQueries()` count queries inside the test:
|
|
524
|
+
|
|
525
|
+
```ts
|
|
526
|
+
import { maxQueries, testTrace } from "@tracepanel/js/vitest";
|
|
527
|
+
|
|
528
|
+
test("feed", { meta: { tracepanel: { maxQueries: 10, allow: ["n+1"] } } }, async () => {
|
|
529
|
+
await request(app).get("/feed");
|
|
530
|
+
expect(testTrace().queries).toBeLessThanOrEqual(10);
|
|
531
|
+
await maxQueries(2, () => request(app).get("/feed?page=2"));
|
|
532
|
+
});
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
`failOn` replaces the kinds that fail the test, `allow` takes kinds out of
|
|
536
|
+
them, and `maxQueries` caps the queries of the test and its requests.
|
|
537
|
+
`await testTrace().issues()` lists what the agent found in the test's
|
|
538
|
+
requests so far.
|
|
539
|
+
|
|
540
|
+
The plugin starts the project's agent when none is running. Without an agent
|
|
541
|
+
(`TRACEPANEL_AGENT=off`) the tests run without findings, and one warning says
|
|
542
|
+
so. Query counts need no agent.
|
|
543
|
+
|
|
301
544
|
## The signed-in user
|
|
302
545
|
|
|
303
546
|
```js
|
|
@@ -330,9 +573,11 @@ Environment variables, as in the Python SDK:
|
|
|
330
573
|
| `TRACEPANEL_LONG_TRANSACTION_MS` | `500` | a long transaction |
|
|
331
574
|
| `TRACEPANEL_QUEUE_WAIT_MS` | `1000` | a task that waited long for a worker |
|
|
332
575
|
| `TRACEPANEL_LARGE_RESULT_ROWS` | `1000` | a query without a LIMIT that read too many rows |
|
|
576
|
+
| `TRACEPANEL_WIDGET` | on (off in tests) | `0` leaves the app's HTML pages without the widget's script |
|
|
333
577
|
| `TRACEPANEL_CAPTURE_REQUEST` | on | `0` stops keeping each request's headers, query, cookies and body |
|
|
334
578
|
| `TRACEPANEL_CAPTURE_LOCALS` | on | `0` stops reading an error's local variables |
|
|
335
579
|
| `TRACEPANEL_PROFILE` | off | `1` profiles every trace, not only a request that asks |
|
|
580
|
+
| `TRACEPANEL_PROFILE_MEMORY` | off | `1` profiles every profiled trace's memory too |
|
|
336
581
|
| `TRACEPANEL_PROFILE_ENABLED` | on | `0` profiles nothing, and the console offers no Profile toggle |
|
|
337
582
|
| `TRACEPANEL_PROFILE_INTERVAL_MS` | `1` | how often a profiled trace is sampled |
|
|
338
583
|
|
|
@@ -352,9 +597,15 @@ installing, the integrations, the browser recording, settings and the command
|
|
|
352
597
|
line. The panel, the console and the issues are the same in every framework,
|
|
353
598
|
under [tracepanel.dev/docs](https://tracepanel.dev/docs).
|
|
354
599
|
|
|
600
|
+
## Links
|
|
601
|
+
|
|
602
|
+
- [tracepanel](https://github.com/tracepanel/tracepanel): what Tracepanel finds,
|
|
603
|
+
how it works, privacy, and the agent this package installs
|
|
604
|
+
- [CHANGELOG.md](CHANGELOG.md): what changed in each version
|
|
605
|
+
|
|
355
606
|
## License
|
|
356
607
|
|
|
357
608
|
Licensed under the [MIT License](LICENSE). The agent npm installs with it,
|
|
358
|
-
`@tracepanel/agent`, is under the
|
|
609
|
+
`@tracepanel/agent`, is free to use under the
|
|
359
610
|
[FSL-1.1-ALv2](https://github.com/tracepanel/tracepanel/blob/main/LICENSE):
|
|
360
611
|
source available, and Apache-2.0 two years after each release.
|
package/dist/agent.d.ts
CHANGED
|
@@ -32,7 +32,9 @@ export declare function sends(name: string): void;
|
|
|
32
32
|
/**
|
|
33
33
|
* The first line to the agent: it finds the issues with this project's limits. What the app offers the console, said
|
|
34
34
|
* here only: it can EXPLAIN a query on its database, its traces hold what each request carried while that is kept,
|
|
35
|
-
* and a request that asks is profiled while profiling is on (the console's Profile toggle shows then)
|
|
35
|
+
* and a request that asks is profiled while profiling is on (the console's Profile toggle shows then), every trace
|
|
36
|
+
* when TRACEPANEL_PROFILE=1 says so (`profile_all`: the toggle shows on), with its memory when a request asks on Node
|
|
37
|
+
* (`profile_memory`), every profiled trace's when TRACEPANEL_PROFILE_MEMORY=1 (`profile_memory_all`); and what it
|
|
36
38
|
* sends besides traces (`live_tasks`).
|
|
37
39
|
*/
|
|
38
40
|
export declare function hello(config: Config): Record<string, unknown>;
|
|
@@ -54,6 +56,8 @@ export declare class Sender {
|
|
|
54
56
|
private said;
|
|
55
57
|
constructor(config: Config, starter: Starter);
|
|
56
58
|
submit(trace: Trace): void;
|
|
59
|
+
/** Sends what is queued now, not with the next batch: a test's traces, whose issues the test waits for. */
|
|
60
|
+
flushNow(): void;
|
|
57
61
|
/** A task event, sent with the next batch: not counted with the traces, and dropped while no agent answers. */
|
|
58
62
|
submitEvent(event: TaskEvent): void;
|
|
59
63
|
private flushSoon;
|
package/dist/agent.js
CHANGED
|
@@ -8,7 +8,7 @@ import { createRequire } from "node:module";
|
|
|
8
8
|
import { connect } from "node:net";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { explain } from "./explain.js";
|
|
11
|
-
import { available as canProfile } from "./profile.js";
|
|
11
|
+
import { available as canProfile, memoryProfiling } from "./profile.js";
|
|
12
12
|
const PROTOCOL = 1;
|
|
13
13
|
const QUEUE_SIZE = 1000;
|
|
14
14
|
const BATCH_SIZE = 50;
|
|
@@ -134,7 +134,9 @@ export function sends(name) {
|
|
|
134
134
|
/**
|
|
135
135
|
* The first line to the agent: it finds the issues with this project's limits. What the app offers the console, said
|
|
136
136
|
* here only: it can EXPLAIN a query on its database, its traces hold what each request carried while that is kept,
|
|
137
|
-
* and a request that asks is profiled while profiling is on (the console's Profile toggle shows then)
|
|
137
|
+
* and a request that asks is profiled while profiling is on (the console's Profile toggle shows then), every trace
|
|
138
|
+
* when TRACEPANEL_PROFILE=1 says so (`profile_all`: the toggle shows on), with its memory when a request asks on Node
|
|
139
|
+
* (`profile_memory`), every profiled trace's when TRACEPANEL_PROFILE_MEMORY=1 (`profile_memory_all`); and what it
|
|
138
140
|
* sends besides traces (`live_tasks`).
|
|
139
141
|
*/
|
|
140
142
|
export function hello(config) {
|
|
@@ -146,7 +148,10 @@ export function hello(config) {
|
|
|
146
148
|
capabilities: [
|
|
147
149
|
"explain",
|
|
148
150
|
...(config.captureRequest ? ["request"] : []),
|
|
149
|
-
...(config.profileEnabled && canProfile() ? ["profile"] : []),
|
|
151
|
+
...(config.profileEnabled && canProfile() ? ["profile", ...(config.profile ? ["profile_all"] : [])] : []),
|
|
152
|
+
...(config.profileEnabled && memoryProfiling()
|
|
153
|
+
? ["profile_memory", ...(config.profileMemory ? ["profile_memory_all"] : [])]
|
|
154
|
+
: []),
|
|
150
155
|
...[...SENDS].sort(),
|
|
151
156
|
],
|
|
152
157
|
};
|
|
@@ -180,6 +185,10 @@ export class Sender {
|
|
|
180
185
|
else
|
|
181
186
|
this.flushSoon(BATCH_WAIT_MS);
|
|
182
187
|
}
|
|
188
|
+
/** Sends what is queued now, not with the next batch: a test's traces, whose issues the test waits for. */
|
|
189
|
+
flushNow() {
|
|
190
|
+
this.flushSoon(0);
|
|
191
|
+
}
|
|
183
192
|
/** A task event, sent with the next batch: not counted with the traces, and dropped while no agent answers. */
|
|
184
193
|
submitEvent(event) {
|
|
185
194
|
if (this.events.length >= QUEUE_SIZE)
|
package/dist/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,oHAAoH;AACpH,kHAAkH;AAClH,uFAAuF;AAEvF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CA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,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAChG,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC"}
|
package/dist/aws.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk";
|
|
2
|
+
import type { Attrs } from "./model.js";
|
|
3
|
+
/** The kind of the span a call to AWS is: what it does for the app. */
|
|
4
|
+
export declare const KIND = "tracepanel.aws.kind";
|
|
5
|
+
/** What a call works on (`bucket/key`, a table, a queue): the end of its span's name. */
|
|
6
|
+
export declare const TARGET = "tracepanel.aws.target";
|
|
7
|
+
/** A service's id as AWS writes it in its SDKs: `S3`, `DynamoDB`, `Secrets Manager`. */
|
|
8
|
+
export declare function serviceId(name: string): string;
|
|
9
|
+
type Input = Record<string, unknown>;
|
|
10
|
+
/** JSON as the Python SDK writes a request's shape: `{"TableName": "users", "Key": {"id": "?"}}`. */
|
|
11
|
+
export declare function spacedJson(value: unknown): string;
|
|
12
|
+
/** The span's kind and what the call works on, from the command the app sent. */
|
|
13
|
+
export declare function described(service: string, operation: string, input: Input): Attrs;
|
|
14
|
+
/** What the operation returned: an object's size, the items a query got, the message's id. */
|
|
15
|
+
export declare function answered(service: string, data: Record<string, unknown> | undefined): Attrs;
|
|
16
|
+
/** A failed call's error code (`NoSuchKey`, `ConditionalCheckFailedException`), and the SDK's retries. */
|
|
17
|
+
export declare function failed(error: unknown): Attrs;
|
|
18
|
+
/** OpenTelemetry's AWS SDK instrumentation, its spans carrying what the agent analyzes a call by. */
|
|
19
|
+
export declare function awsInstrumentation(): AwsInstrumentation;
|
|
20
|
+
export declare function isAws(attrs: Attrs): boolean;
|
|
21
|
+
/** A call to AWS as the agent reads it: `S3 GetObject avatars/1.png`, its kind and its attributes. */
|
|
22
|
+
export declare function awsCall(attrs: Attrs): {
|
|
23
|
+
kind: string;
|
|
24
|
+
name: string;
|
|
25
|
+
attrs: Attrs;
|
|
26
|
+
};
|
|
27
|
+
export {};
|