Repository navigation
feat: publish every query on the tracing channel reylo:query - #117
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed the reylo:query tracing channel end to end: the channel lookup, how it wraps each run method, the exported context type, the docs and the tests. tests/trace.test.ts passes locally on Node 24 (8 of 8).
src/trace.ts: findsnode:diagnostics_channelat run time throughprocess.getBuiltinModule, which every supported Node has (engines: >=24).listening()asks each of the five event channels for subscribers, so a query nobody traces builds no context.src/index.ts: the oldrunis nowrunOnce. The newrunwraps it intracePromise, which covers.run(),.try()and the function.with()returns..runSync()wraps its body intraceSync, and.trySync()goes throughquery.runSync, so each call publishes once.runOnceturns every throw into a rejection, so an async call always reachesasyncEnd, and the docs'end/asyncEndsplit never leaves a span open.QueryTrace: re-exported as a type fromreylo.trace.tsimports only types fromindex.ts, so the two files don't import each other at run time.- Docs and skill: a
### Tracingsubsection in02-usage.mdx, plus a line in the README and inskills/using-reylo/SKILL.md. The twoslash block'simport type { QueryTrace } from "reylo"resolves throughsite/lib/twoslash.ts, which mounts the repository'ssrc/index.ts. - Tests: they check the event order for each method, publishing once for
.try()and.trySync(), the driver running inside the store bound tostart, and the subscriber check on all five events.
claude-opus-5-5 | 𝕏
colinhacks
force-pushed
the
tracing-channel
branch
from
October 24, 2026 03:30
5c45593 to
0fca856
Compare
Each .run(), .runSync(), .try(), .trySync() and call of the function .with() returns is one call on node:diagnostics_channel's tracing channel, carrying the query, client, params, sync, and its result or error. The module is looked up at run time, so a runtime without it runs queries untraced.
colinhacks
force-pushed
the
tracing-channel
branch
from
October 24, 2026 04:32
0fca856 to
6e8f0ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Every query Reylo runs is now published on Node's tracing channel
reylo:query, so a tracer or a logger can wrap each one in a span without wrapping the driver or every call..run(),.try()and each call of the function.with()returns are onetracePromise;.runSync()and.trySync()onetraceSync. Binding with.with()publishes nothing.QueryTrace, exported fromreylo): thequery(its.sourceand.sqlname it), theclient, theparams,sync, and theresultorerror. A database error.try()returns as a value is published as an error too.start.runStores, so a store a tracer binds tostartis the current one while the driver runs, and the driver's own spans nest under the query's.src/trace.tslooks the module up throughprocess.getBuiltinModuleinstead of importing it, so a bundle for a runtime without it still builds and runs its queries untraced. With no subscriber, no context is built. Bun'sTracingChannelhas nohasSubscribersof its own, so each event's channel is asked.bun:sqlite), and workerd withnodejs_compat(and without it, where the channel is simply absent).Docs: a Tracing subsection at the end of Usage, linked from
.source; a sentence in the README; and a line in theusing-reyloskill.Tests:
tests/trace.test.tscovers each method's events and their order, the context's fields, errors (the driver's and Reylo's row count),.try()and.trySync()publishing once,.with(), a store bound tostartseen by the driver, and the subscriber check on each of the five events.