Skip to content

docs(js): Replace Mastra community exporter with first-party integration - #19296

Draft
RulaKhaled wants to merge 4 commits into
masterfrom
rola/mastra-first-party-integration
Draft

docs(js): Replace Mastra community exporter with first-party integration#19296
RulaKhaled wants to merge 4 commits into
masterfrom
rola/mastra-first-party-integration

Conversation

@RulaKhaled

@RulaKhaled RulaKhaled commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

DESCRIBE YOUR PR

The JavaScript SDK now instruments Mastra natively (sentry-javascript#23823). mastraIntegration is a default integration in Node runtimes and registers a Sentry exporter on Mastra's observability pipeline. Both Mastra docs pages still described the community @mastra/sentry exporter, which calls Sentry.init() itself, so this replaces them.

/platforms/javascript/guides/node/agent-tracing/mastra/

  • Restructured to the LangGraph/LangChain integration-page pattern: Automatic Instrumentation, Manual Instrumentation, Configuration/Options, Supported Operations, Supported Versions.
  • Automatic setup is now just installing @mastra/observability — the SDK bootstraps the pipeline when the app configured none, and attaches its exporter to an existing Observability when it did.
  • Added SentryMastraExporter as the manual escape hatch for bundled server builds, with a <PlatformSection> warning on the meta-framework guides.
  • Corrected the span mapping table to what the SDK actually emits. The old table listed workflow.run, workflow.step, ai.processor and ai.span, none of which are produced; added provider_tool_call, client_tool_call and rag_embedding, and explained why unmapped types are dropped and their children re-parented.
  • Documented recordInputs, recordOutputs and bootstrapObservability, plus how to disable the integration.
  • Added a migration section: why leaving @mastra/sentry in place either replaces the configured client (losing release, environment, integrations, sampling) or starts a second SDK.

/platforms/javascript/guides/mastra/

  • Rewritten as a @sentry/node setup guide instead of a standalone-exporter walkthrough: install @sentry/node + @mastra/observability, instrument.mjs with --import, then nothing to change on the Mastra side. Same URL and StepConnector structure.

Also

  • Updated the Mastra card copy on the home page (src/components/home.tsx).

Note: both pages cite Sentry SDK 11.0.0 as the minimum. This should go with v11 release.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.
Select exactly one option. For deadlines, replace YYYY-MM-DD with the due date. You can update this information later by editing the PR description.

  • Urgent deadline (GA date, etc.): YYYY-MM-DD
  • Other deadline: YYYY-MM-DD
  • No deadline: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've supplied a deadline.

Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

🤖 Generated with Claude Code

https://claude.ai/code/session_01Cy8ky8AVsY8dxgUNzWQMMT

The JavaScript SDK now instruments Mastra natively via `mastraIntegration`,
enabled by default in Node runtimes. Both Mastra pages still documented the
community `@mastra/sentry` exporter, which initializes its own Sentry client.

- Rewrite the agent-tracing page around `Sentry.mastraIntegration` and
  `Sentry.SentryMastraExporter`, following the LangGraph/LangChain page
  pattern: Automatic Instrumentation, Manual Instrumentation, Options,
  Supported Operations.
- Correct the span mapping table to what the SDK actually emits. The old
  table listed `workflow.run`, `ai.processor` and `ai.span`, none of which
  are produced; add `provider_tool_call`, `client_tool_call` and
  `rag_embedding`, and explain why unmapped types are dropped.
- Document `recordInputs`, `recordOutputs` and `bootstrapObservability`,
  and add a migration section covering why leaving `@mastra/sentry`
  installed replaces or duplicates the configured client.
- Rewrite the standalone Mastra guide as a `@sentry/node` setup: install
  `@sentry/node` and `@mastra/observability`, `instrument.mjs` plus
  `--import`, then no Mastra-side configuration.
- Update the Mastra card copy on the home page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cy8ky8AVsY8dxgUNzWQMMT
@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-docs Ready Ready Preview Sep 9, 2026 1:49pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
develop-docs Ignored Ignored Preview Sep 9, 2026 1:49pm UTC

Request Review

The page claimed meta-frameworks bundle Mastra into the server build where
"the SDK can't hook it at runtime", and told users to fall back to manual
instrumentation. That is wrong: every meta-framework SDK registers the
orchestrion code transform over the server build by default, and
`mastraConfig` is in the `SENTRY_INSTRUMENTATIONS` set those plugins inject.

Verified on a real Next.js app (@mastra/core 1.63.2, no `Observability`
configured, no manual exporter):

- Next 15.5.4, webpack build: integration subscribes, emits
  `gen_ai.invoke_agent` and `gen_ai.chat`.
- Next 16.2.11, Turbopack build: same spans.
- Next 15.5.4, `next build --turbopack`: never subscribes, no spans.

The last case is the only real gap, and it matches the code —
`supportsTurbopackRuleCondition` gates the Turbopack loader rule on Next
major >= 16. Replace the blanket meta-framework warning with that specific
caveat, note that bundled server builds are covered by the build-time
transform, and point Manual Instrumentation at the cases where the transform
doesn't run (Next 15 + Turbopack, or `buildTimeInstrumentation: false`).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cy8ky8AVsY8dxgUNzWQMMT
The caveat named a version without the reason, and scoped the gap to
`next build` when it applies to `next dev --turbopack` too.

Verified by inspecting the config `withSentryConfig` produces, with the same
SDK build and app and only the Next.js version changed:

- Next 16.2.11, TURBOPACK=1: orchestrion loader rule present, condition "node".
- Next 15.5.4,  TURBOPACK=1: no orchestrion loader rule at all.

The rule needs Turbopack's `condition` field to scope the transform to the
Node server compilation; that field landed in Next.js 16. Without it the
loader would also run over the client and edge compilations, so the SDK omits
the rule rather than inject `node:diagnostics_channel` into browser bundles.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cy8ky8AVsY8dxgUNzWQMMT
The alert named only Next.js 15, but the gate is `major >= 16`
(`supportsTurbopackRuleCondition`), and `@sentry/nextjs` supports
`^14.0 || ^15.0.0-rc.0 || ^16.0.0-0`, so Next.js 14 is affected too — via
`--turbo`, which bundler detection also matches.

Also call out that the result can differ between environments: `next dev
--turbopack` produces no spans while a webpack production build of the same
app works, which reads as a broken integration rather than an uncovered
bundler.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cy8ky8AVsY8dxgUNzWQMMT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: Normal Docs review has no urgent deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant