@tracepanel/js 0.4.1 → 0.6.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.
Files changed (81) hide show
  1. package/README.md +224 -12
  2. package/dist/agent.d.ts +5 -1
  3. package/dist/agent.js +12 -3
  4. package/dist/agent.js.map +1 -1
  5. package/dist/aws.d.ts +27 -0
  6. package/dist/aws.js +368 -0
  7. package/dist/aws.js.map +1 -0
  8. package/dist/bun.js +6 -82
  9. package/dist/bun.js.map +1 -1
  10. package/dist/calls.d.ts +5 -0
  11. package/dist/calls.js +7 -0
  12. package/dist/calls.js.map +1 -1
  13. package/dist/config.d.ts +7 -0
  14. package/dist/config.js +2 -0
  15. package/dist/config.js.map +1 -1
  16. package/dist/explain.d.ts +5 -0
  17. package/dist/explain.js +56 -7
  18. package/dist/explain.js.map +1 -1
  19. package/dist/fastify.d.ts +2 -0
  20. package/dist/fastify.js +100 -0
  21. package/dist/fastify.js.map +1 -0
  22. package/dist/frameworks.js +3 -0
  23. package/dist/frameworks.js.map +1 -1
  24. package/dist/hono.d.ts +2 -0
  25. package/dist/hono.js +63 -0
  26. package/dist/hono.js.map +1 -0
  27. package/dist/koa.d.ts +2 -0
  28. package/dist/koa.js +119 -0
  29. package/dist/koa.js.map +1 -0
  30. package/dist/llm.d.ts +20 -0
  31. package/dist/llm.js +632 -0
  32. package/dist/llm.js.map +1 -0
  33. package/dist/memory.d.ts +69 -0
  34. package/dist/memory.js +203 -0
  35. package/dist/memory.js.map +1 -0
  36. package/dist/model.d.ts +22 -1
  37. package/dist/model.js.map +1 -1
  38. package/dist/next.js +4 -4
  39. package/dist/next.js.map +1 -1
  40. package/dist/processor.d.ts +40 -4
  41. package/dist/processor.js +156 -29
  42. package/dist/processor.js.map +1 -1
  43. package/dist/profile.d.ts +34 -8
  44. package/dist/profile.js +98 -13
  45. package/dist/profile.js.map +1 -1
  46. package/dist/queries.d.ts +20 -0
  47. package/dist/queries.js +75 -0
  48. package/dist/queries.js.map +1 -0
  49. package/dist/respond.d.ts +12 -0
  50. package/dist/respond.js +85 -0
  51. package/dist/respond.js.map +1 -0
  52. package/dist/setup.js +22 -5
  53. package/dist/setup.js.map +1 -1
  54. package/dist/sql.d.ts +1 -0
  55. package/dist/sql.js +11 -2
  56. package/dist/sql.js.map +1 -1
  57. package/dist/sqlite.d.ts +13 -0
  58. package/dist/sqlite.js +291 -0
  59. package/dist/sqlite.js.map +1 -0
  60. package/dist/stack.d.ts +3 -1
  61. package/dist/stack.js +30 -6
  62. package/dist/stack.js.map +1 -1
  63. package/dist/testing.d.ts +128 -0
  64. package/dist/testing.js +362 -0
  65. package/dist/testing.js.map +1 -0
  66. package/dist/transactions.d.ts +11 -1
  67. package/dist/transactions.js +70 -34
  68. package/dist/transactions.js.map +1 -1
  69. package/dist/view.d.ts +17 -0
  70. package/dist/view.js +71 -0
  71. package/dist/view.js.map +1 -0
  72. package/dist/vitest-setup.d.ts +1 -0
  73. package/dist/vitest-setup.js +63 -0
  74. package/dist/vitest-setup.js.map +1 -0
  75. package/dist/vitest.d.ts +57 -0
  76. package/dist/vitest.js +130 -0
  77. package/dist/vitest.js.map +1 -0
  78. package/dist/widget.d.ts +16 -0
  79. package/dist/widget.js +33 -1
  80. package/dist/widget.js.map +1 -1
  81. package/package.json +69 -4
package/README.md CHANGED
@@ -4,20 +4,50 @@
4
4
  [![npm](https://img.shields.io/npm/v/@tracepanel/js)](https://www.npmjs.com/package/@tracepanel/js)
5
5
  [![Node.js](https://img.shields.io/node/v/@tracepanel/js)](https://www.npmjs.com/package/@tracepanel/js)
6
6
 
7
- **See what your app does on every request.** Tracepanel records each request
8
- of your Express, NestJS, Next.js, Nuxt or Bun app with its SQL queries, logs
9
- and errors. It finds N+1 queries, duplicate queries and slow SQL, and names
10
- the line of code to fix. You read it in a panel on your pages and in a
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
- ## Setup
15
+ [![A 40-second demo of a Next.js store: Swagger UI's Try it out on an endpoint, and the panel docked under it with the request's call tree, an N+1 with its query plan and line, a BullMQ job, the CPU profile, and the same call after the fix](https://raw.githubusercontent.com/tracepanel/tracepanel-js/main/assets/demo-video.jpg)](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
+ | **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. |
26
+ | **Redis and MongoDB** | `ioredis` and `redis`, and the MongoDB driver, with their own N+1 and duplicates. |
27
+ | **HTTP clients** | `fetch()`, and `node:http` clients such as axios, on Node and on Bun. |
28
+ | **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. |
29
+ | **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. |
30
+ | **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. |
31
+ | **Logs** | `console`, pino, winston and Nest's `Logger`, each line on the request or job that wrote it. |
32
+ | **Errors** | Thrown in a handler, with your frames, their source and, on Node, their local variables. |
33
+ | **Profiling** | Where a request's CPU time goes, and on request its memory and garbage collections, on Node. |
34
+ | **Tests** | Vitest 4.1 and later: a test fails when it makes an N+1 or duplicate queries. |
35
+ | **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. |
36
+
37
+ The settings and what each integration records are in the
38
+ [JavaScript docs](https://tracepanel.dev/docs/javascript).
39
+
40
+ ## Install
16
41
 
17
42
  ```bash
18
43
  npm install @tracepanel/js
19
44
  ```
20
45
 
46
+ It brings the agent for your platform, `@tracepanel/agent`, which keeps the
47
+ traces and serves the console.
48
+
49
+ ## Setup
50
+
21
51
  Tracepanel is on unless `NODE_ENV` is `production`. `TRACEPANEL_ENABLED=0`
22
52
  turns it off and `TRACEPANEL_ENABLED=1` turns it on. It starts its agent on
23
53
  the first request. The agent keeps the traces in `.tracepanel/` in your
@@ -62,6 +92,85 @@ await import("./server.js");
62
92
 
63
93
  The agent starts by itself either way, on the app's first request.
64
94
 
95
+ ### Fastify
96
+
97
+ Load Tracepanel before the app as for Express, and register the plugin
98
+ before the routes, so it sees each one as it is added:
99
+
100
+ ```bash
101
+ node --import @tracepanel/js/register server.js
102
+ ```
103
+
104
+ ```js
105
+ import Fastify from "fastify";
106
+ import { tracepanel } from "@tracepanel/js/fastify";
107
+
108
+ const app = Fastify();
109
+ await app.register(tracepanel());
110
+ app.get("/books/:id", async (request) => findBook(request.params.id));
111
+ ```
112
+
113
+ Each request is named by its route (`GET /books/:id`), and its handler is a
114
+ step of its own, with the line that added the route. HTML pages get the
115
+ badge, sent whole or streamed. An error Fastify answers with a 500 is the
116
+ request's error, with its local variables; one it answers below 500, such
117
+ as a validation error or a `statusCode: 404`, is the response.
118
+
119
+ ### Koa
120
+
121
+ Load Tracepanel before the app as for Express, and add the middleware first:
122
+
123
+ ```bash
124
+ node --import @tracepanel/js/register server.js
125
+ ```
126
+
127
+ ```js
128
+ import Koa from "koa";
129
+ import Router from "@koa/router";
130
+ import { tracepanel } from "@tracepanel/js/koa";
131
+
132
+ const app = new Koa();
133
+ app.use(tracepanel());
134
+ const router = new Router();
135
+ router.get("/books/:id", async (ctx) => {
136
+ ctx.body = await findBook(ctx.params.id);
137
+ });
138
+ app.use(router.routes());
139
+ ```
140
+
141
+ Each `@koa/router` route's handler is a step named by its route, and so is
142
+ the request, nested routers' prefixes included. The badge goes on HTML pages,
143
+ and on the answer Koa gives an error. `ctx.throw(404)` is the response, not
144
+ an error.
145
+
146
+ ### Hono
147
+
148
+ On Node, serve the app with `@hono/node-server`, load Tracepanel before it,
149
+ and add the middleware first:
150
+
151
+ ```bash
152
+ node --import @tracepanel/js/register server.js
153
+ ```
154
+
155
+ ```js
156
+ import { serve } from "@hono/node-server";
157
+ import { Hono } from "hono";
158
+ import { tracepanel } from "@tracepanel/js/hono";
159
+
160
+ const app = new Hono();
161
+ app.use(tracepanel());
162
+ app.get("/books/:id", async (c) => c.json(await findBook(c.req.param("id"))));
163
+ serve({ fetch: app.fetch });
164
+ ```
165
+
166
+ Each request is named by its route, a sub-app's base path included, and its
167
+ handler is a step of its own. HTML pages get the badge, and the request's
168
+ body goes into its trace as far as the handler read it. An `HTTPException`
169
+ below 500, or what `app.onError` answers below 500, is the response.
170
+
171
+ On Bun, add the same middleware and serve the app with `serve()` from
172
+ `@tracepanel/js/bun` (see Bun below), which puts the badge on the response.
173
+
65
174
  ### NestJS
66
175
 
67
176
  Nest runs on Express: load Tracepanel the same way and add the same
@@ -155,7 +264,9 @@ badge on server-rendered pages, and records the errors h3 answers with a 500.
155
264
  ### Bun
156
265
 
157
266
  `serve()` is `Bun.serve` with each route traced under its pattern, and
158
- `withTracepanel()` wraps any fetch handler, such as Hono's `app.fetch`:
267
+ `withTracepanel()` wraps any fetch handler, such as Elysia's `handle`. A Hono
268
+ app is `serve({ fetch: app.fetch })`, with its `tracepanel()` middleware (see
269
+ Hono above) naming its routes:
159
270
 
160
271
  ```bash
161
272
  bun --preload @tracepanel/js/register server.ts
@@ -223,6 +334,21 @@ console on the page's origin (`api`, `/__tracepanel__/` by default).
223
334
  `ignoreSources` takes the path prefixes of scripts whose console isn't the
224
335
  page's, such as a dev server's client.
225
336
 
337
+ ## What it looks like
338
+
339
+ Each request shows its call tree, with the SQL queries, the calls and the
340
+ issues in it. Here a Next.js store on Postgres lists its products from
341
+ Swagger UI, and loads each product's category, brand and rating in a query of
342
+ its own:
343
+
344
+ ![A Next.js app's Swagger UI with an endpoint run with Try it out and the start of its 200 response, and the panel docked under it with the same request's call tree and its three N+1 queries](https://raw.githubusercontent.com/tracepanel/tracepanel-js/main/assets/panel-call-tree.png)
345
+
346
+ The panel also lists what happened on the page: its view, each click, and the
347
+ requests it made with `fetch()`, here Swagger UI's Execute. Each issue names
348
+ the line that ran it and the fix:
349
+
350
+ ![The same Swagger UI with the panel docked under it on that request's Issues tab: each N+1 with the line it comes from and the fix](https://raw.githubusercontent.com/tracepanel/tracepanel-js/main/assets/panel-issues.png)
351
+
226
352
  ## What it records
227
353
 
228
354
  - HTTP requests, with the route and the handler that served them, and what
@@ -250,13 +376,16 @@ page's, such as a dev server's client.
250
376
  - A form's POST that redirects to another page: the panel on that page
251
377
  lists the POST before it.
252
378
  - SQL from `pg` and `mysql2` (and so Drizzle, Knex, Sequelize, TypeORM and
253
- Prisma's driver adapters), with the line of your code that ran each
379
+ Prisma's driver adapters), and from SQLite through `better-sqlite3`,
380
+ Node's `node:sqlite` and `libsql`, with the line of your code that ran each
254
381
  statement. A statement no code of yours made, such as a session store's,
255
382
  names the library code that asked for it, past the driver and the ORM;
256
383
  so do Redis and MongoDB commands. Prisma's operations show as steps.
257
- - Transactions: BEGIN … COMMIT (or ROLLBACK) on a `pg` client or a `mysql2`
258
- connection, with its statements and the calls made inside it, and its
259
- savepoints.
384
+ - Transactions: BEGIN … COMMIT (or ROLLBACK) on a `pg` client, a `mysql2`
385
+ connection or a SQLite database, and better-sqlite3's `db.transaction()`,
386
+ with its statements and the calls made inside it, and its savepoints.
387
+ - The console's EXPLAIN of a SQLite query (EXPLAIN QUERY PLAN) runs on the
388
+ app's own connection, so a database in memory has a plan too.
260
389
  - Redis commands (`ioredis`, `redis`) and MongoDB commands, with their own
261
390
  N+1 and duplicates.
262
391
  - Outgoing HTTP calls: `fetch()`, and `node:http` clients such as axios, on
@@ -280,6 +409,19 @@ page's, such as a dev server's client.
280
409
  every request at once, so a profile keeps the samples taken while its
281
410
  request was the only one running, and counts the rest
282
411
  (`tracepanel.dropped_samples`). Time spent waiting on I/O is not in it.
412
+ Every profile counts the garbage collector's runs and their pauses.
413
+ - A profile's memory too, when asked: `X-Tracepanel-Profile: memory`, the
414
+ `tracepanel_profile=memory` cookie (the panel's Profile toggle offers
415
+ it), or `TRACEPANEL_PROFILE_MEMORY=1`. V8's sampling heap profiler takes
416
+ about one allocation in every 32 KB with its stack: the profile shows the
417
+ heap's peak above where the request started, what V8 allocated in all
418
+ (on Node 26), and the 50 sites whose allocations still lived at its end.
419
+ The heap is the whole process's, so a request that ran beside others says
420
+ so. It costs: code runs about 15% slower while it is sampled, and reading
421
+ the sampler's profile makes V8 collect the whole heap once at the end of
422
+ each such request, after its response, which stops the process for a few
423
+ milliseconds on a small heap and over 100 ms on a heap of a few hundred
424
+ MB. Leave it off when you measure time. Not on Bun.
283
425
  - The caller's trace, when a request carries a W3C `traceparent`: the agent
284
426
  links the two.
285
427
 
@@ -298,6 +440,65 @@ request it is a step. `span()` is a step of the current trace. Outside
298
440
  development they run the function and nothing else. Run a script with
299
441
  `npx tracepanel run node script.js`.
300
442
 
443
+ ## In tests
444
+
445
+ The Vitest plugin turns what Tracepanel finds into test failures, so an N+1
446
+ query fails CI before it reaches production. Add it to the Vitest config:
447
+
448
+ ```ts
449
+ // vitest.config.ts
450
+ import { defineConfig } from "vitest/config";
451
+ import { tracepanel } from "@tracepanel/js/vitest";
452
+
453
+ export default defineConfig({
454
+ plugins: [tracepanel()], // or tracepanel({ failOn: ["n+1", "duplicates", "slow-sql"] })
455
+ });
456
+ ```
457
+
458
+ Each test runs as a trace named after the test, with its queries in it. A
459
+ request the test makes of a server it started (supertest, `fetch()`) is a
460
+ trace of its own, linked to the test's in the console. Work in `beforeAll` is
461
+ outside every test's trace; `beforeEach` and `afterEach` run inside it.
462
+
463
+ When the test passes, the agent looks at its traces. An issue of a kind in
464
+ `failOn` (`n+1` and `duplicates` by default) fails the test with the issue,
465
+ its query, the line of code that ran it and a link to the trace:
466
+
467
+ ```text
468
+ AssertionError: tracepanel found 1 issue in this test:
469
+
470
+ N+1: 4 similar queries · SELECT authors
471
+ SELECT name FROM authors WHERE id = $1
472
+ at src/books.ts:28 in listBooks
473
+ in GET /books → http://127.0.0.1:52068/#/t/01M60NB74Q6T9AXZGMFJ7V8FB1
474
+ Load the related rows with the parent rows (a join, or one batched query) instead of one query per row.
475
+
476
+ The test's trace: http://127.0.0.1:52068/#/t/01M60NB74J4Q5VDHCJD1Z4T1J7
477
+ Allowed here with the test's option { meta: { tracepanel: { allow: ["n+1"] } } }.
478
+ ```
479
+
480
+ The `tracepanel` meta changes the rules for a test or a `describe()`, and
481
+ `testTrace()` and `maxQueries()` count queries inside the test:
482
+
483
+ ```ts
484
+ import { maxQueries, testTrace } from "@tracepanel/js/vitest";
485
+
486
+ test("feed", { meta: { tracepanel: { maxQueries: 10, allow: ["n+1"] } } }, async () => {
487
+ await request(app).get("/feed");
488
+ expect(testTrace().queries).toBeLessThanOrEqual(10);
489
+ await maxQueries(2, () => request(app).get("/feed?page=2"));
490
+ });
491
+ ```
492
+
493
+ `failOn` replaces the kinds that fail the test, `allow` takes kinds out of
494
+ them, and `maxQueries` caps the queries of the test and its requests.
495
+ `await testTrace().issues()` lists what the agent found in the test's
496
+ requests so far.
497
+
498
+ The plugin starts the project's agent when none is running. Without an agent
499
+ (`TRACEPANEL_AGENT=off`) the tests run without findings, and one warning says
500
+ so. Query counts need no agent.
501
+
301
502
  ## The signed-in user
302
503
 
303
504
  ```js
@@ -330,9 +531,11 @@ Environment variables, as in the Python SDK:
330
531
  | `TRACEPANEL_LONG_TRANSACTION_MS` | `500` | a long transaction |
331
532
  | `TRACEPANEL_QUEUE_WAIT_MS` | `1000` | a task that waited long for a worker |
332
533
  | `TRACEPANEL_LARGE_RESULT_ROWS` | `1000` | a query without a LIMIT that read too many rows |
534
+ | `TRACEPANEL_WIDGET` | on (off in tests) | `0` leaves the app's HTML pages without the widget's script |
333
535
  | `TRACEPANEL_CAPTURE_REQUEST` | on | `0` stops keeping each request's headers, query, cookies and body |
334
536
  | `TRACEPANEL_CAPTURE_LOCALS` | on | `0` stops reading an error's local variables |
335
537
  | `TRACEPANEL_PROFILE` | off | `1` profiles every trace, not only a request that asks |
538
+ | `TRACEPANEL_PROFILE_MEMORY` | off | `1` profiles every profiled trace's memory too |
336
539
  | `TRACEPANEL_PROFILE_ENABLED` | on | `0` profiles nothing, and the console offers no Profile toggle |
337
540
  | `TRACEPANEL_PROFILE_INTERVAL_MS` | `1` | how often a profiled trace is sampled |
338
541
 
@@ -352,6 +555,15 @@ installing, the integrations, the browser recording, settings and the command
352
555
  line. The panel, the console and the issues are the same in every framework,
353
556
  under [tracepanel.dev/docs](https://tracepanel.dev/docs).
354
557
 
558
+ ## Links
559
+
560
+ - [tracepanel](https://github.com/tracepanel/tracepanel): what Tracepanel finds,
561
+ how it works, privacy, and the agent this package installs
562
+ - [CHANGELOG.md](CHANGELOG.md): what changed in each version
563
+
355
564
  ## License
356
565
 
357
- Licensed under the [MIT License](LICENSE).
566
+ Licensed under the [MIT License](LICENSE). The agent npm installs with it,
567
+ `@tracepanel/agent`, is free to use under the
568
+ [FSL-1.1-ALv2](https://github.com/tracepanel/tracepanel/blob/main/LICENSE):
569
+ 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); and what it
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); and what it
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,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAe,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAuB,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,SAAS,IAAI,UAAU,EA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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 {};