This repo is meant to reproduce an issue with sentry's structured logs and their correlation with traces.
In theory, the traces shown in the logs in sentry should relate to traces that are collected during requests. But currently they don't.
To test this issue
set your sentry DSN in ./config.ts then
make sure you have installed
- node 22 (I have
v22.9.0) (you can also use node 23 to get rid of the--experimental-strip-typesor use tsx, I tried both, too) - bun (I have 1.2.5)
- pnpm (I have v10.11.0)
Then run pnpm install and then for
- bun :
bun run apps/bun/index.ts - node+hono :
node --experimental-strip-types apps/node-hono/index.ts - node+express :
node --experimental-strip-types apps/node-express/index.ts
For each app, open http://localhost:3000 (or whatever PORT you've set in config.ts).
Then, in sentry, check logs, traces and issues.
You should see the traces are correct and the exceptions are properly linked. Logs however, have a different trace id that cannot be found in traces.
In @sentry/core it seems that the logger lib feeds the trace id of the propagation context to log entries
via Sentry.getCurrentScope().getPropagationContext().traceId.