docs(javascript): rework Mastra guide to SDK-based setup, extend Node guide - #19445
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
|
||
| The Sentry SDK instruments Mastra on its own — there's no exporter to register and no manual wiring. Sentry's Mastra integration is enabled by default and reads Mastra's AI telemetry, so a plain `Sentry.init()` is all you need. | ||
|
|
||
| Running Mastra on Cloudflare Workers? Follow the [Cloudflare Quick Start](./cloudflare/) instead. |
There was a problem hiding this comment.
Maybe we should put this into a highlighted box.
There was a problem hiding this comment.
I updated this generally a bit!
| ## Privacy Controls | ||
|
|
||
| Generative AI inputs and outputs — the prompts your agent sends and the model responses it receives — are recorded on your AI spans by default. Review the data your agent handles and tighten this before production. To turn recording off, set `genAI.inputs` and `genAI.outputs` to `false` in `dataCollection`: | ||
|
|
||
| ```javascript {filename:src/mastra/public/instrument.mjs} | ||
| Sentry.init({ | ||
| dsn: "___PUBLIC_DSN___", | ||
| dataCollection: { | ||
| genAI: { inputs: false, outputs: false }, | ||
| }, | ||
| }); | ||
| ``` |
There was a problem hiding this comment.
Other docs show this as part of the "configure" step, I think we could also move this up to be aligned.
https://docs.sentry.io/platforms/javascript/#control-the-data-you-send-to-sentry-optional
|
|
||
| ## Privacy Controls | ||
|
|
||
| Generative AI inputs and outputs — the prompts your agent sends and the model responses it receives — are recorded on your AI spans by default. Review the data your agent handles and tighten this before production. To turn recording off, set `genAI.inputs` and `genAI.outputs` to `false` in `dataCollection`: |
There was a problem hiding this comment.
Keep in mind, that inputs and outputs handle more than just the prompts. Maybe also link to this page, without listing everything inline: https://docs.sentry.io/platforms/javascript/configuration/options/#dataCollection
From our docs:
For inputs: Include the content of generative AI inputs. This gates system instructions, prompt messages, tool definitions, and tool call arguments.
For outputs: Include the content of generative AI outputs (e.g. completion text, tool call results).
https://develop.sentry.dev/sdk/foundations/client/data-collection/#datacollection-options
There was a problem hiding this comment.
btw, I opened a PR that updates the option docs so they are more detailed: https://github.com/getsentry/sentry-docs/pull/19454/changes#diff-96c5d3a51798dece73da3ce1b4537fac346e8bc11f5f331c57bcb48e6e7efeaaR157
There was a problem hiding this comment.
updates this whole section a bit to reflect this better and link out!
| }); | ||
| ``` | ||
|
|
||
| ## Link Conversations |
There was a problem hiding this comment.
Link Conversations and Next Steps is not part of the numbered view. Usually, the setup guides have numbered items until Next Steps.
There was a problem hiding this comment.
moved this up, good point!
|
|
||
| </StepConnector> | ||
|
|
||
| ## Privacy Controls |
There was a problem hiding this comment.
Privacy Controls and Link Conversations probably also works in Cloudflare. You could create a platform include and use this in both guides.
There was a problem hiding this comment.
I updated this so it is more or less the same in cloudflare and node. moved this into includes!
RulaKhaled
left a comment
There was a problem hiding this comment.
https://sentry-docs-git-mastra-guide-sdk-setup.sentry.dev/platforms/javascript/guides/nextjs/agent-tracing/mastra/ this still references @mastra/sentry, could you also cover it?
| supported: | ||
| - javascript.node | ||
| - javascript.eve | ||
| - javascript.mastra |
There was a problem hiding this comment.
https://sentry-docs-git-mastra-guide-sdk-setup.sentry.dev/platforms/javascript/guides/nextjs/agent-tracing/mastra/ this still references @mastra/sentry, could you also cover this file?
There was a problem hiding this comment.
removed this whole thing and redirecting to the guide now!
0dbcde0 to
a94ac37
Compare
1211929 to
5bda762
Compare
f29b796 to
f232f6c
Compare
8dccef0 to
67ad3bb
Compare
coolguyzone
left a comment
There was a problem hiding this comment.
Looks good, thanks for updating!
… guide Rework the standalone Mastra guide to the Sentry SDK-based setup (rc.0+), mirroring the Eve guide. - Extend the Node guide (fallbackGuide: javascript.node) instead of inheritCommonContent: false, with the mastra icon. - Replace the @mastra/sentry exporter approach with a plain Sentry.init(); Sentry's Mastra integration is enabled by default and needs @mastra/observability. - Document the Node setup (instrument.mjs in src/mastra/public, preloaded via mastra --custom-args="--import=./instrument.mjs") as primary, with a Cloudflare Workers install variant (@sentry/cloudflare + sentryCloudflareVitePlugin + instrument.server.ts + nodejs_compat), matching the node-mastra and cloudflare-mastra e2e test apps. - Require @sentry/node / @sentry/cloudflare >=11.0.0-rc.0 and @mastra/core >=1.63.2; update the captured-span mapping to the built-in integration. - Add javascript.mastra to every supported/notSupported list in JS common content wherever javascript.eve appears, so inherited Node sections render and browser-only content is hidden from the Mastra guide. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Sigrid <32902192+s1gr1d@users.noreply.github.com> Co-authored-by: Francesco Gringl-Novy <francesconovy@gmail.com>
…ptions - Rework the Mastra guide's quick start to mirror the Eve guide: StepConnector stepper and OnboardingOptionButtons (error-monitoring / performance / profiling, performance on by default), with profiling install/config variants. - Remove the old exporter-based agent-tracing/mastra.mdx subpage and redirect its routes (plus the older configuration/integrations and ai-agent-* aliases) directly to the standalone guide, matching how Eve was consolidated. - Surface Mastra and Eve as link-only entries in every JavaScript Agent Tracing sidebar that navigate straight to their standalone guides (platformSidebar.tsx), reusing the existing Cloudflare alias mechanism. The Agent Tracing index grid keeps the Mastra and Eve cards. - Note that users upgrading from the community @mastra/sentry exporter must remove it, and require @mastra/observability (no version pinned). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…stra
Recovers the standalone Cloudflare Quick Start (a force-push had overwritten it)
and reconciles it with the Node onboarding rework.
- Re-add guides/mastra/cloudflare/index.mdx (sidebar_order 0.5) as a self-contained
Cloudflare Workers quick start that links back to the default quick start.
- Main quick start links to it ("Running Mastra on Cloudflare Workers? Follow the
Cloudflare Quick Start instead.") and drops the inline Cloudflare Expandable; the
Node onboarding options (performance default, profiling variants) stay.
- Make the main prerequisites Node-only and note that both `mastra build` and
`mastra dev` copy `public/`.
- Clarify that Conversation linking is automatic via Mastra's memory thread id — no
Sentry-specific setup.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Move Privacy Controls and Link Conversations under Configuration as h3 subsections in the main Mastra quick start. - Rework the Cloudflare Quick Start to mirror the main quick start's structure and content (onboarding options, stepper, Configure with Privacy Controls and Link Conversations subheadings, Verify, Next Steps, What gets captured, Supported Versions), with Cloudflare-specific snippets. Profiling is omitted since it isn't available on Workers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extract the content shared between the Node and Cloudflare Mastra quick starts into reusable includes under includes/mastra/ and reference them from both pages: - sdk-setup-alert, captured-summary, link-conversations, verify, next-steps, what-gets-captured. Page-specific content (install commands, instrument snippets, Privacy Controls code and its dataCollection link, Supported Versions) stays inline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Mastra guide has its own dedicated quick start, so it no longer inherits the generic Agent Tracing provider pages. Remove javascript.mastra from the agent-tracing library pages (openai, anthropic, google-genai, langchain, langgraph, vercelai, manual-instrumentation, flue) so those pages are no longer generated under the Mastra guide. Keep javascript.mastra where the guide still inherits Node content: add it back alongside javascript.eve in the tracing Session Replay notSupported lists so browser-only content stays hidden from the Mastra guide. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rename the destructured `guide` in the standalone-guide agent-tracing alias mapping so it no longer shadows the outer `guide` binding. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Alex Krawiec <alex.krawiec@sentry.io>
c0fb579 to
bda0708
Compare
The Flue guide extends the Node guide through `fallbackGuide`, but `PlatformSection` doesn't resolve that, so `javascript.flue` has to be enumerated wherever `javascript.eve` already is — in both directions. Without it the inherited Node sections don't render in the Flue guide and browser-only content isn't hidden from it. 102 frontmatter entries and 37 PlatformSection arrays across 106 files, matching what #19445 does for `javascript.mastra`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… guide (#19445) ## DESCRIBE YOUR PR Reworks the standalone **Mastra** JavaScript guide to the Sentry SDK-based setup, mirroring the Eve guide (#19310). Based on the [`node-mastra`](https://github.com/getsentry/sentry-javascript/tree/develop/dev-packages/e2e-tests/test-applications/node-mastra) and [`cloudflare-mastra`](https://github.com/getsentry/sentry-javascript/tree/develop/dev-packages/e2e-tests/test-applications/cloudflare-mastra) e2e test apps. - **Extends the Node guide** (`fallbackGuide: javascript.node`) instead of `inheritCommonContent: false`, so the Mastra guide inherits the Node common pages. Adds the `mastra` icon. - **Replaces the `@mastra/sentry` exporter** with a plain `Sentry.init()`. Sentry's Mastra integration is enabled by default and auto-bootstraps observability through `@mastra/observability`. Adds a warning against running the community `@mastra/sentry` exporter alongside it. - **Node setup (primary):** `instrument.mjs` in `src/mastra/public/`, preloaded via `mastra dev/start --custom-args="--import=./instrument.mjs"`. - **Cloudflare Workers (install variant):** `@sentry/cloudflare` + `sentryCloudflareVitePlugin()` + `src/instrument.server.ts` + `nodejs_compat`. - Requires `@sentry/node` / `@sentry/cloudflare` `>=11.0.0-rc.0` and `@mastra/core` `>=1.63.2`; updates the captured-span mapping to the built-in integration. - Adds `javascript.mastra` to every `supported`/`notSupported` list in JS common content wherever `javascript.eve` appears (112 files), so inherited Node sections render and browser-only content is hidden from the Mastra guide. `PlatformSection` doesn't resolve `fallbackGuide`, so `javascript.mastra` must be enumerated alongside `javascript.node`/`javascript.eve` in both directions. ## 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 - [x] 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](https://github.com/orgs/getsentry/teams/docs) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Sigrid <32902192+s1gr1d@users.noreply.github.com> Co-authored-by: Alex Krawiec <alex.krawiec@sentry.io>
DESCRIBE YOUR PR
Reworks the standalone Mastra JavaScript guide to the Sentry SDK-based setup, mirroring the Eve guide (#19310). Based on the
node-mastraandcloudflare-mastrae2e test apps.fallbackGuide: javascript.node) instead ofinheritCommonContent: false, so the Mastra guide inherits the Node common pages. Adds themastraicon.@mastra/sentryexporter with a plainSentry.init(). Sentry's Mastra integration is enabled by default and auto-bootstraps observability through@mastra/observability. Adds a warning against running the community@mastra/sentryexporter alongside it.instrument.mjsinsrc/mastra/public/, preloaded viamastra dev/start --custom-args="--import=./instrument.mjs".@sentry/cloudflare+sentryCloudflareVitePlugin()+src/instrument.server.ts+nodejs_compat.@sentry/node/@sentry/cloudflare>=11.0.0-rc.0and@mastra/core>=1.63.2; updates the captured-span mapping to the built-in integration.javascript.mastrato everysupported/notSupportedlist in JS common content whereverjavascript.eveappears (112 files), so inherited Node sections render and browser-only content is hidden from the Mastra guide.PlatformSectiondoesn't resolvefallbackGuide, sojavascript.mastramust be enumerated alongsidejavascript.node/javascript.evein both directions.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-DDwith the due date. You can update this information later by editing the PR description.SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
🤖 Generated with Claude Code