Skip to content

feat(node): Rewrite tedious instrumentation to orchestrion tracing channels#22238

Open
logaretm wants to merge 1 commit into
developfrom
awad/js-2417-rewrite-opentelemetryinstrumentation-tedious-to-orchestrion
Open

feat(node): Rewrite tedious instrumentation to orchestrion tracing channels#22238
logaretm wants to merge 1 commit into
developfrom
awad/js-2417-rewrite-opentelemetryinstrumentation-tedious-to-orchestrion

Conversation

@logaretm

@logaretm logaretm commented Jul 13, 2026

Copy link
Copy Markdown
Member

Migrates the tedious integration off the vendored InstrumentationBase onto a node:diagnostics_channel subscriber whose channels orchestrion injects into the library. The OTel path stays as the fallback when orchestrion isn't injected.

closes #20766

@linear-code

linear-code Bot commented Jul 13, 2026

Copy link
Copy Markdown

JS-2417

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.65 kB - -
@sentry/browser - with treeshaking flags 26.1 kB - -
@sentry/browser (incl. Tracing) 46.42 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.21 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.2 kB - -
@sentry/browser (incl. Tracing, Replay) 85.67 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.31 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.38 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.04 kB - -
@sentry/browser (incl. Feedback) 44.83 kB - -
@sentry/browser (incl. sendFeedback) 32.45 kB - -
@sentry/browser (incl. FeedbackAsync) 37.58 kB - -
@sentry/browser (incl. Metrics) 28.74 kB - -
@sentry/browser (incl. Logs) 28.98 kB - -
@sentry/browser (incl. Metrics & Logs) 29.67 kB - -
@sentry/react 29.45 kB - -
@sentry/react (incl. Tracing) 48.68 kB - -
@sentry/vue 33.08 kB - -
@sentry/vue (incl. Tracing) 48.4 kB - -
@sentry/svelte 27.67 kB - -
CDN Bundle 30.05 kB - -
CDN Bundle (incl. Tracing) 48.41 kB - -
CDN Bundle (incl. Logs, Metrics) 31.64 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.71 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.87 kB - -
CDN Bundle (incl. Tracing, Replay) 85.9 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.21 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.7 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.97 kB - -
CDN Bundle - uncompressed 89.58 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.33 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.29 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.31 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.02 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.54 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.5 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.24 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.19 kB - -
@sentry/nextjs (client) 51.22 kB - -
@sentry/sveltekit (client) 46.86 kB - -
@sentry/core/server 78.51 kB - -
@sentry/core/browser 64.86 kB - -
@sentry/node-core 62.79 kB - -
@sentry/node 125.19 kB - -
@sentry/node (incl. diagnostics channel injection) 140.76 kB +0.56% +781 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.96 kB - -
@sentry/node/light 50.8 kB +0.01% +1 B 🔺
@sentry/node - without tracing 74.17 kB - -
@sentry/aws-serverless 83.39 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 181.79 kB - -
@sentry/cloudflare (withSentry) 449.98 kB - -

View base workflow run

@logaretm logaretm force-pushed the awad/js-2417-rewrite-opentelemetryinstrumentation-tedious-to-orchestrion branch from f0842ac to 9a144dd Compare July 14, 2026 16:16
@logaretm logaretm marked this pull request as ready for review July 14, 2026 17:32
@logaretm logaretm requested review from a team as code owners July 14, 2026 17:32
@logaretm logaretm requested review from JPeer264, isaacs and mydea and removed request for a team July 14, 2026 17:32

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9a144dd. Configure here.

name: getSpanName(operation, databaseName, sql, request.table),
kind: SPAN_KIND.CLIENT,
attributes,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing db span op attribute

Medium Severity

startInactiveSpan sets sentry.origin but never sets a span op (op: 'db' or SEMANTIC_ATTRIBUTE_SENTRY_OP). Sibling orchestrion DB integrations set this explicitly so spans stay correct outside the Node OTel inference path. Flagged because the PR review guidelines require both origin and op on every startSpan API call.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 9a144dd. Configure here.

Comment thread packages/server-utils/src/integrations/tracing-channel/tedious.ts Outdated
…annels

Migrate the tedious 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.

tedious is a default performance integration, so it uses the central `channelIntegrations` swap: `_init` filters the OTel `Tedious` integration out of the defaults by name and appends the channel one. No per-integration node code.

The subscriber wraps the six `Connection` request methods (one db span each) and `Connection.connect` (active-database bookkeeping). Each method returns synchronously while the request settles later via its callback/events, so the subscriber owns span-ending: it wraps `request.callback` and listens for the request `error` and connection `end` events, mirroring the vendored OTel instrumentation.

Fixes #20766
@logaretm logaretm force-pushed the awad/js-2417-rewrite-opentelemetryinstrumentation-tedious-to-orchestrion branch from 9a144dd to ca2f97c Compare July 14, 2026 18:09
Comment on lines +143 to +147
const span = startInactiveSpan({
name: getSpanName(operation, databaseName, sql, request.table),
kind: SPAN_KIND.CLIENT,
attributes,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The startInactiveSpan call for the tedious integration is missing the op: 'db' field, which is present in other database integrations like mysql and postgres.
Severity: MEDIUM

Suggested Fix

Add op: 'db' to the options object passed to the startInactiveSpan function in tedious.ts, similar to how it is done in mysql.ts and postgres.ts. This will ensure consistency across database integrations.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/server-utils/src/integrations/tracing-channel/tedious.ts#L143-L147

Potential issue: In `tedious.ts`, the call to `startInactiveSpan` does not include the
`op: 'db'` field in its options. This is inconsistent with other database integrations
like `mysql.ts` and `postgres.ts`, which explicitly set this field. The associated tests
expect the `op` field to be present on the generated spans. Its absence will cause test
failures and may affect how these spans are processed or displayed, as they will be
missing a key piece of contextual information that identifies them as database
operations.

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.

Rewrite @opentelemetry/instrumentation-tedious to orchestrion

1 participant