Skip to content

feat(mongoose): implement orchestrion mongoose integration#22202

Merged
isaacs merged 2 commits into
developfrom
isaacs/orchestrion-mongoose
Jul 16, 2026
Merged

feat(mongoose): implement orchestrion mongoose integration#22202
isaacs merged 2 commits into
developfrom
isaacs/orchestrion-mongoose

Conversation

@isaacs

@isaacs isaacs commented Jul 13, 2026

Copy link
Copy Markdown
Member

Port the OTel mongoose intstrumentation to Orchestrion. Add Deno integration, and node integration tests for mongoose versions 5, 6, 7, 8, and 9.

Native diagnostics channel used on Mongoose versions supporting them (ie, 9.7+).

Fix: #20761
Fix: #20761

@isaacs
isaacs requested a review from a team as a code owner July 13, 2026 00:35
@isaacs
isaacs requested review from JPeer264, andreiborza and mydea and removed request for a team July 13, 2026 00:35
@linear-code

linear-code Bot commented Jul 13, 2026

Copy link
Copy Markdown

JS-2412

@isaacs isaacs changed the title Isaacs/orchestrion mongoose feat(mongoose): implement orchestrion mongoose integration Jul 13, 2026
@isaacs
isaacs force-pushed the isaacs/orchestrion-mongoose branch from 6c2328d to d62144c Compare July 13, 2026 00:36
Comment thread packages/server-utils/src/orchestrion/config/mongoose.ts
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.74 kB - -
@sentry/browser - with treeshaking flags 26.19 kB - -
@sentry/browser (incl. Tracing) 46.57 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.36 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.34 kB - -
@sentry/browser (incl. Tracing, Replay) 85.83 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.46 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.55 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.18 kB - -
@sentry/browser (incl. Feedback) 44.92 kB - -
@sentry/browser (incl. sendFeedback) 32.54 kB - -
@sentry/browser (incl. FeedbackAsync) 37.67 kB - -
@sentry/browser (incl. Metrics) 28.84 kB - -
@sentry/browser (incl. Logs) 29.07 kB - -
@sentry/browser (incl. Metrics & Logs) 29.76 kB - -
@sentry/react 29.54 kB - -
@sentry/react (incl. Tracing) 48.82 kB - -
@sentry/vue 33.17 kB - -
@sentry/vue (incl. Tracing) 48.55 kB - -
@sentry/svelte 27.77 kB - -
CDN Bundle 30.14 kB - -
CDN Bundle (incl. Tracing) 48.52 kB - -
CDN Bundle (incl. Logs, Metrics) 31.72 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.83 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.97 kB - -
CDN Bundle (incl. Tracing, Replay) 86.04 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.82 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.09 kB - -
CDN Bundle - uncompressed 89.85 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.66 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.56 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.64 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.28 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.86 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.82 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.56 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.52 kB - -
@sentry/nextjs (client) 51.38 kB - -
@sentry/sveltekit (client) 47 kB - -
@sentry/core/server 78.71 kB - -
@sentry/core/browser 65.08 kB - -
@sentry/node-core 63.21 kB -0.01% -1 B 🔽
@sentry/node 125.54 kB +0.07% +86 B 🔺
⛔️ @sentry/node (incl. diagnostics channel injection) (max: 148 kB) 148.09 kB +0.5% +736 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB - -
@sentry/node/light 51.33 kB +0.01% +2 B 🔺
@sentry/node - without tracing 74.7 kB - -
@sentry/aws-serverless 83.92 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 182.1 kB - -
@sentry/cloudflare (withSentry) 450.9 kB - -

View base workflow run

@isaacs
isaacs force-pushed the isaacs/orchestrion-mongoose branch from d62144c to 2d38636 Compare July 13, 2026 00:57
Comment thread packages/server-utils/src/mongoose/mongoose-legacy-span.ts

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice. LGTM

@isaacs
isaacs enabled auto-merge (squash) July 16, 2026 00:31
@isaacs
isaacs force-pushed the isaacs/orchestrion-mongoose branch from 44073c9 to 05a59f8 Compare July 16, 2026 00:33
@isaacs
isaacs requested a review from a team as a code owner July 16, 2026 00:33
@isaacs
isaacs requested review from msonnb and removed request for a team July 16, 2026 00:33
@isaacs
isaacs force-pushed the isaacs/orchestrion-mongoose branch from 05a59f8 to 7082702 Compare July 16, 2026 14:04

@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 7082702. Configure here.

Comment thread packages/deno/test/__snapshots__/mod.test.ts.snap Outdated
@isaacs
isaacs force-pushed the isaacs/orchestrion-mongoose branch 3 times, most recently from b193268 to 7fea0e9 Compare July 16, 2026 16:49
Port the OTel mongoose intstrumentation to Orchestrion. Add Deno
integration, and node integration tests for mongoose versions 5, 6, 7,
8, and 9.

Native diagnostics channel used on Mongoose versions supporting them
(ie, 9.7+).

Fix: JS-2412
Fix: #20761
@isaacs
isaacs force-pushed the isaacs/orchestrion-mongoose branch from 7fea0e9 to a192937 Compare July 16, 2026 21:46
import type { SentryTracingChannel } from '../../tracing-channel';
import { bindTracingChannelToSpan } from '../../tracing-channel';

const INTEGRATION_NAME = 'Mongoose' as const;

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 Node.js mongoose integration imports the old mongooseIntegration instead of the new orchestrion-based one, causing a lack of instrumentation for mongoose versions < 9.7.
Severity: HIGH

Suggested Fix

In packages/node/src/integrations/tracing/mongoose/index.ts, update the import statement to pull from the new orchestrion path. Change import { mongooseIntegration as mongooseChannelIntegration } from '@sentry/server-utils'; to import { mongooseChannelIntegration } from '@sentry/server-utils/orchestrion'; to ensure the Node integration uses the correct, complete implementation.

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/mongoose.ts#L13

Potential issue: The Node.js mongoose integration in
`packages/node/src/integrations/tracing/mongoose/index.ts` incorrectly imports an older
`mongooseIntegration` from `@sentry/server-utils` instead of the new,
orchestrion-compatible `mongooseChannelIntegration`. The old integration only supports
native diagnostics channels for mongoose versions 9.7 and newer. The new integration is
designed to add support for older mongoose versions via orchestrion-injected channels.
By importing the old integration, the Node.js SDK will fail to instrument mongoose
versions older than 9.7, which undermines a primary goal of the changes in this pull
request.

Also affects:

  • packages/server-utils/src/mongoose/index.ts:2~10

@isaacs
isaacs merged commit e36268b into develop Jul 16, 2026
37 of 39 checks passed
@isaacs
isaacs deleted the isaacs/orchestrion-mongoose branch July 16, 2026 23:44
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-mongoose to orchestrion

2 participants