Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
driver-compat:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 20
services:
postgres:
image: postgres:16
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- **node-redis:** `instrumentNodeRedis(tp, require('redis'))` for `redis` / `@redis/client` 4 and 5: `redis GET`, `redis HSET`; MULTI and pipeline commands are tracked one by one. Auto-instrumented as the `redis` target.

### Fixed
- `sqlLabel`: `CREATE TABLE IF NOT EXISTS "Users"` (Sequelize's `sync()`) and `DROP TABLE IF EXISTS` were labelled `CREATE IF`; they are now `CREATE Users` / `DROP Users`.
- **MongoDB driver 3.x / Mongoose 5:** `aggregate()` was labelled `mongo find $cmd`; it is now `mongo aggregate users`.

### Changed
- CI runs every driver integration against old and new majors on real servers (pg 8.0 and 8.x, mysql2 2 and 3, mysql 2, mongodb 3–7, Mongoose 5–8, ioredis 4 and 5, better-sqlite3 11 and 12): `test/compat`. The first run found the bug above.
- CI runs every driver integration against old and new majors on real servers (pg 8.0 and 8.x, mysql2 2 and 3, mysql 2, mongodb 3–7, Mongoose 5–8, ioredis 4 and 5, node-redis 4 and 5, Prisma 5 and 6 on SQLite, Sequelize 6 and Knex 2 and 3 on pg and mysql2, better-sqlite3 11 and 12): `test/compat`. The first run found the bug above.
- Timing tests that assert on synchronous durations use a virtual clock, so a loaded CI machine can't fail them.

## [1.8.0] - 2026-11-06
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- **Honest numbers.** You get total, self and synchronous time for each call. Detailed mode flags calls that blocked the event loop.
- **Production-ready.** Stats are bounded per label (p50/p95/p99), sampling is built in, and `enabled: false` makes tracking a pass-through costing ~40 ns.
- **Gets data out.** Chrome/Perfetto traces, OpenTelemetry spans, JSON lines, or your own `onComplete` hook.
- **Zero-effort coverage.** One line tracks every `fetch`, HTTP request or query, for pg, mysql2, mysql, MongoDB/Mongoose, ioredis, Prisma, better-sqlite3 (and Drizzle on any of these drivers) and the AWS SDK.
- **Zero-effort coverage.** One line tracks every `fetch`, HTTP request or query, for pg, mysql2, mysql, MongoDB/Mongoose, ioredis, node-redis, Prisma, better-sqlite3 (and Drizzle, Sequelize and Knex on any of these drivers) and the AWS SDK.
- **Built for teams.** It feeds Prometheus, catches regressions in CI (`traceperf compare --fail`), shows up in Chrome DevTools, and produces HTML flame-chart reports.
- **Fits your stack.** Express, Fastify, Hono, Koa, NestJS, Next.js route handlers, decorators, CommonJS, ESM, TypeScript, browsers, Node.js 14+, Bun, Deno, Cloudflare Workers and Vercel Edge. There are no runtime dependencies.

Expand Down Expand Up @@ -136,7 +136,7 @@ The same naming works without `run`: `TRACEPERF_PROFILE_BLOCKING=1 node --requir

## No code changes: `traceperf/auto`

Start your app with traceperf preloaded. Every incoming HTTP request becomes a tree, with the outgoing `http`/`fetch` calls and the `pg`, `mysql2`, `mysql`, MongoDB/Mongoose, `ioredis`, Prisma and `better-sqlite3` queries it made nested under it (Drizzle runs on these drivers, so its queries show up too):
Start your app with traceperf preloaded. Every incoming HTTP request becomes a tree, with the outgoing `http`/`fetch` calls and the `pg`, `mysql2`, `mysql`, MongoDB/Mongoose, `ioredis`, `redis`, Prisma and `better-sqlite3` queries it made nested under it (Drizzle, Sequelize and Knex run on these drivers, so their queries show up too):

<!-- docs:skip -->
```bash
Expand All @@ -162,7 +162,7 @@ Database clients are only instrumented when your `package.json` lists them. Conf
| `TRACEPERF_THRESHOLD=50` | Only report calls taking at least 50 ms |
| `TRACEPERF_SAMPLE_RATE=0.1` | Track 10% of requests |
| `TRACEPERF_IGNORE=^/health` | Regular expression of request paths not to track |
| `TRACEPERF_DISABLE=http,fetch` | Skip targets: `server`, `http`, `fetch`, `pg`, `mysql2`, `mongodb`, `ioredis`, `prisma`, `better-sqlite3`, `mysql` |
| `TRACEPERF_DISABLE=http,fetch` | Skip targets: `server`, `http`, `fetch`, `pg`, `mysql2`, `mongodb`, `ioredis`, `prisma`, `better-sqlite3`, `mysql`, `redis` |
| `TRACEPERF_SILENT=1` / `TRACEPERF_SUMMARY=0` / `TRACEPERF_QUIET=1` | No per-request trees / no exit summary / no startup line |
| `TRACEPERF_ENABLED=0` | Load nothing |

Expand Down Expand Up @@ -248,6 +248,7 @@ instrumentMysql(tp, require('mysql')); // the classic driver: conne
instrumentMongo(tp, require('mongodb')); // "mongo find users", "mongo insertOne users"
instrumentMongo(tp, require('mongoose').mongo); // Mongoose uses its own copy of the driver
instrumentRedis(tp, require('ioredis')); // "redis GET"
instrumentNodeRedis(tp, require('redis')); // "redis GET" (node-redis 4/5, MULTI/pipeline commands one by one)
instrumentPrisma(tp, require('@prisma/client')); // "prisma.User.findMany" (every client, $extends included)
instrumentBetterSqlite3(tp, require('better-sqlite3')); // "sqlite SELECT users" (synchronous: slow ones show as blocking)
instrumentAwsClient(tp, s3Client); // "aws S3.GetObject"
Expand Down
217 changes: 217 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@
"pg": "^8.23.1",
"prettier": "^3.5.3",
"publint": "^0.3.25",
"redis": "^5.12.1",
"redis4": "npm:redis@^4.7.1",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.2",
"ts-jest": "^29.2.6",
Expand Down
Loading
Loading