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

@isaacsisaacs 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 ownerJuly 13, 2026 00:35
@isaacs
isaacs requested review from JPeer264, andreiborza and mydea and removed request for a teamJuly 13, 2026 00:35
@linear-code

Copy link
Copy Markdown

JS-2412

@isaacsisaacs changed the title Isaacs/orchestrion mongoosefeat(mongoose): implement orchestrion mongoose integrationJul 13, 2026
@isaacs
isaacsforce-pushed the isaacs/orchestrion-mongoose branch from 6c2328d to d62144cCompareJuly 13, 2026 00:36
Comment threadpackages/server-utils/src/orchestrion/config/mongoose.ts
@github-actions

github-actionsBot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser27.74 kB--
@sentry/browser - with treeshaking flags26.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 flags75.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/react29.54 kB--
@sentry/react (incl. Tracing)48.82 kB--
@sentry/vue33.17 kB--
@sentry/vue (incl. Tracing)48.55 kB--
@sentry/svelte27.77 kB--
CDN Bundle30.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 - uncompressed89.85 kB--
CDN Bundle (incl. Tracing) - uncompressed146.66 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed94.56 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed150.64 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed219.28 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed265.86 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed269.82 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed279.56 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed283.52 kB--
@sentry/nextjs (client)51.38 kB--
@sentry/sveltekit (client)47 kB--
@sentry/core/server78.71 kB--
@sentry/core/browser65.08 kB--
@sentry/node-core63.21 kB-0.01%-1 B 🔽
@sentry/node125.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/light51.33 kB+0.01%+2 B 🔺
@sentry/node - without tracing74.7 kB--
@sentry/aws-serverless83.92 kB+0.01%+1 B 🔺
@sentry/cloudflare (withSentry) - minified182.1 kB--
@sentry/cloudflare (withSentry)450.9 kB--

View base workflow run

@isaacs
isaacsforce-pushed the isaacs/orchestrion-mongoose branch from d62144c to 2d38636CompareJuly 13, 2026 00:57
Comment threadpackages/server-utils/src/mongoose/mongoose-legacy-span.ts

@JPeer264JPeer264 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
isaacsforce-pushed the isaacs/orchestrion-mongoose branch from 44073c9 to 05a59f8CompareJuly 16, 2026 00:33
@isaacs
isaacs requested a review from a team as a code ownerJuly 16, 2026 00:33
@isaacs
isaacs requested review from msonnb and removed request for a teamJuly 16, 2026 00:33
@isaacs
isaacsforce-pushed the isaacs/orchestrion-mongoose branch from 05a59f8 to 7082702CompareJuly 16, 2026 14:04

@cursorcursorBot 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 threadpackages/deno/test/__snapshots__/mod.test.ts.snap Outdated
@isaacs
isaacsforce-pushed the isaacs/orchestrion-mongoose branch 3 times, most recently from b193268 to 7fea0e9CompareJuly 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
isaacsforce-pushed the isaacs/orchestrion-mongoose branch from 7fea0e9 to a192937CompareJuly 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 developJul 16, 2026
37 of 39 checks passed
@isaacs
isaacs deleted the isaacs/orchestrion-mongoose branch July 16, 2026 23:44
Sign up for freeto 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

@isaacs@JPeer264