Skip to content

Label Fastify requests by route - #18

Merged
thelastbackspace merged 1 commit into
mainfrom
feat/fastify-routes
Nov 6, 2026
Merged

thelastbackspace merged 1 commit into
mainfrom
feat/fastify-routes

Conversation

@thelastbackspace

Copy link
Copy Markdown
Owner

From running traceperf run on a Fastify 4 + Drizzle + pg RealWorld app: every article slug and username was its own label.

  • traceperf/auto: when the app depends on fastify, its module export is replaced (in the module cache, before the app loads it; require and import both read it) with a factory that adds an onRequest hook writing request.routeOptions.url (routerPath before 4.10) onto the raw request
  • the server instrumentation labels by that route; Express's req.route is still used when it is absent
  • ROUTE symbol exported so other frameworks can do the same; wrapFastifyFactory for manual use
  • tested against real Fastify 5 (prefixes, unmatched URLs) and by hand on the Fastify 4 app through tsx

@thelastbackspace
thelastbackspace merged commit d703a18 into main Nov 6, 2026
14 checks passed
@thelastbackspace
thelastbackspace deleted the feat/fastify-routes branch November 6, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant