feat(node): Rewrite knex instrumentation to orchestrion tracing channels#22237
Open
logaretm wants to merge 2 commits into
Open
feat(node): Rewrite knex instrumentation to orchestrion tracing channels#22237logaretm wants to merge 2 commits into
logaretm wants to merge 2 commits into
Conversation
Contributor
size-limit report 📦
|
fea4e2e to
f04f9e0
Compare
f04f9e0 to
189751c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 189751c. Configure here.
mydea
reviewed
Jul 14, 2026
| // Prefer the diagnostics-channel subscriber when orchestrion injected its channels; otherwise | ||
| // fall back to the vendored OTel instrumentation. `isOrchestrionInjected()` is only reliable by | ||
| // `setupOnce` (the runtime injection runs during `Sentry.init()`, after integrations are built). | ||
| if (isOrchestrionInjected()) { |
Member
There was a problem hiding this comment.
is this needed, I think other integrations (at least the ones I migrated) did not use this pattern?
Member
Author
There was a problem hiding this comment.
Yep, because this is not a default integration so it wouldn't be swapped in by the existing mechanism we have.
It is similar to the one in #20749 and NestJS
189751c to
204a03a
Compare
Migrate the knex integration off the vendored `InstrumentationBase` monkey-patch onto a `node:diagnostics_channel` subscriber whose channels are injected by the orchestrion code transform. The OTel path stays as the fallback when orchestrion isn't injected. knex is opt-in (not a default performance integration), so the `@sentry/node` factory picks the path itself in `setupOnce` via `isOrchestrionInjected()` rather than the central `channelIntegrations` swap. `Runner.query` produces the span; `Client.queryBuilder`/`schemaBuilder`/`raw` are wrapped for bookkeeping so the span active at builder-creation time is reused as the parent when the query runs later. Fixes #20757
Add an opt-in `denoKnexIntegration` that reuses the shared knex channel subscriber from `@sentry/server-utils` and installs Deno's AsyncLocalStorage context strategy, mirroring the other Deno DB integrations. Exported but kept out of the default set, matching knex being opt-in on Node.
9caa486 to
0fe09bf
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.

Migrates the knex integration off the vendored
InstrumentationBasemonkey-patch onto anode:diagnostics_channelsubscriber whose channels are injected by the orchestrion code transform. The vendored OTel path stays as the fallback when orchestrion isn't injected.closes #20757