Skip to content

docs(javascript): Give Flue its own guide with SDK-based setup - #19528

Open
RulaKhaled wants to merge 6 commits into
masterfrom
rola/flue-guide-sdk-setup
Open

RulaKhaled wants to merge 6 commits into
masterfrom
rola/flue-guide-sdk-setup

Conversation

@RulaKhaled

@RulaKhaled RulaKhaled commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

DESCRIBE YOUR PR

Gives Flue its own JavaScript guide on the Sentry SDK-based setup, mirroring the Mastra guide (#19445). Based on the node-flue and cloudflare-flue e2e test apps.

  • Extends the Node guide (fallbackGuide: javascript.node), so the Flue guide inherits the Node common pages. Adds the flue icon. Deletes common/agent-tracing/flue.mdx and redirects it, Cloudflare page first.
  • Replaces the flue add tooling sentry blueprint, which wires Sentry up through @flue/opentelemetry. The SDK instruments Flue directly now. Adds a warning to remove the blueprint's createOpenTelemetryInstrumentation call, which double-counts gen_ai spans.
  • Node setup (primary): Sentry.init() plus instrument(Sentry.createFlueInstrumentation()), imported as the first line of src/app.ts. Flue is registered rather than patched, so that call is the wiring.
  • Cloudflare Workers: sentryCloudflareVitePlugin() registers the instrumentation at build time, so there's no instrument() call. Each agent runs in its own Durable Object, so the guide leads with the extend({ wrap }) wrapper that gets Sentry.init() into that isolate — without it the agent runs fine, turns settle, nothing errors, and nothing is captured.
  • Documents that instrument.server.ts does nothing for Flue. That convention needs a worker entry in Wrangler's main; Flue supplies its own virtual entry instead. Verified against cloudflare-flue.
  • Requires @sentry/node / @sentry/cloudflare >=11.0.0-rc.0 and @flue/runtime >=2.0.0 <3.0.0. Corrects the old Correlation Tags section: the SDK emits gen_ai.conversation.id, gen_ai.agent.name, and flue.turn.purpose, not the blueprint's flue.instance.id / flue.agent.name / flue.submission.id.
  • Adds javascript.flue to every supported/notSupported list in JS common content wherever javascript.eve appears (106 files), so inherited Node sections render and browser-only content is hidden from the Flue guide. PlatformSection doesn't resolve fallbackGuide, so javascript.flue must be enumerated alongside javascript.node/javascript.eve in both directions.

Follow-ups: Flue needs a STANDALONE_AGENT_TRACING_GUIDES entry (sidebar_order: 28) once #19445 lands; the version pins need revisiting once getsentry/sentry-javascript#24476 ships; and the double-counting warning is reasoned from both instrumentations registering through instrument() under different keys, not run against the blueprint.

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

The Flue page documented the `flue add tooling sentry` blueprint, which wires
Sentry up through `@flue/opentelemetry`. The SDK now instruments Flue directly,
so this replaces it with a guide per runtime — the two setups differ enough that
one page with platform sections was hiding the important parts.

On Node the SDK is registered with `instrument(Sentry.createFlueInstrumentation())`.
On Cloudflare the Vite plugin registers it at build time, but each agent runs in
its own Durable Object, so the guide leads with the wrapper that gets
`Sentry.init()` into that isolate — without it nothing is captured and nothing
errors, which is the failure people hit first.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 21, 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 22, 2026 10:24am UTC
1 Skipped Deployment
Project Deployment Actions Updated
develop-docs Ignored Ignored Preview Sep 22, 2026 10:24am UTC

Request Review

@github-actions github-actions Bot added the Priority: Needs Triage The PR description is missing valid priority information label Sep 21, 2026
@github-actions github-actions Bot added Priority: Normal Docs review has no urgent deadline and removed Priority: Needs Triage The PR description is missing valid priority information labels Sep 21, 2026
…ing content forward

The rework dropped sections the old page got right. Conversations come back as
`gen_ai.conversation.id`, corrected from the blueprint's `flue.*` correlation
tags, which the SDK does not emit. Adds `flue.turn.purpose` to the captured
table, the doubling and missing-span troubleshooting entries, and Flue's own
observability guide to next steps.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>
Master landed the same move for Mastra that this branch makes for Flue:
lifting it out of the Agent Tracing page into its own guide. Almost every
conflict was the two registrations landing on the same line.

Resolutions:

- Platform lists that gained `javascript.flue` here and `javascript.mastra`
  on master keep both, Flue first, matching the position after
  `javascript.eve`.
- Master replaced the long explicit server-platform lists with
  `notSupportedCategories: server-only`. Took master's version and dropped
  the lists, which needed the Flue guide's `categories` fixed: it had
  `javascript` and `server-node`, neither of which is a `PlatformCategory`,
  so no category rule matched it. Now `server` and `server-only`, the same
  as Eve and Mastra.
- `common/agent-tracing/mastra.mdx` is deleted on master, so this branch's
  edit to it goes away with the file.
- `redirects.js` keeps both redirect blocks and drops the stale comment
  this branch had written to introduce Mastra's.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ides

Master added `STANDALONE_AGENT_TRACING_GUIDES` when it lifted Mastra into its
own guide, so every JavaScript guide's Agent Tracing section keeps a link-only
entry pointing at the dedicated guide. This branch forked before that existed
and deletes `common/agent-tracing/flue.mdx`, so Flue was dropping out of those
sidebars entirely.

`sidebar_order: 28` is the order the deleted page carried, which keeps Flue
after Mastra and Eve where readers already expect it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Checked every claim in the guide against the SDK source and against a real
`flue build` app (`@sentry/node@11.0.0-rc.1`, `@flue/runtime@2.0.3`, Node
24.11.1, live provider). What did not hold up:

- "Instrument HTTP and Database Calls" is gone. Running the app with and
  without `NODE_OPTIONS='--import=@sentry/node/import'` produced the same
  spans both times: `http.server`, two `http.client` to the provider, and
  the full `gen_ai` set. The Node client constructor already calls
  `registerDiagnosticsChannelInjection()`, so `Sentry.init()` installs the
  hooks itself. The database half could never be true either — Flue's
  default `sqlite()` adapter is `node:sqlite`, which has no entry in
  `SENTRY_RUNTIME_INSTRUMENTATIONS`.
- Registering twice does not stack observers. `createFlueInstrumentation()`
  sets `key: FLUE_INSTRUMENTATION_KEY`, so Flue throws
  `InstrumentationAlreadyInstalledError` in production and swaps the
  registration in dev. The warning described the keyless case.
- "before Flue loads your agents" is not the requirement. A real `flue build`
  hoists `@flue/runtime` above the bundle body that runs `Sentry.init()`, and
  the spans still arrive. Running before a turn is what matters.
- The conversation id is per conversation, not per agent instance. Two chat
  ids against one agent in one process produced two different
  `gen_ai.conversation.id` values.
- `gen_ai.agent.name` lands only on the `invoke_agent` span, so it cannot be
  used to compare token use, which is recorded on the `chat` span.
- Tool errors are always captured. `endToolSpan()` calls `captureToolError()`
  whenever `isError` is set, and the recovered case is exactly the one Flue
  hands back to the model, so nothing "stays on the trace as context".
- The Cloudflare floor was wrong. `sentryFlueRuntimeProviderPlugin` is absent
  from `@sentry/cloudflare@11.0.0-rc.0` and first ships in rc.1.
  `@sentry/node`'s `createFlueInstrumentation` is in rc.0, so that floor stays.

Verified and left alone: the `dataCollection.genAI` defaults (both `true` in
`resolveDataCollectionOptions`), the operation mapping table, the
`auto.ai.flue` origin, `flue.turn.purpose`, the `instrument.server.ts`
troubleshooting note, and every API name on the Cloudflare page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@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.

Added couple of points.


## Supported Versions

- `@sentry/node`: `>=11.0.0-rc.0`

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.

l: Maybe it's better to keep just one RC version in the docs, even if rc.0 is already supporting it. Or just move to v11: https://github.com/getsentry/sentry-docs/pull/19528/changes#r4071017479

Suggested change
- `@sentry/node`: `>=11.0.0-rc.0`
- `@sentry/node`: `>=11.0.0-rc.1`


- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/). The project's DSN tells the SDK where to send data.
- A Flue application using `@flue/runtime` version `2.0.0` or later. Flue requires Node.js `22.19` or later.
- `@sentry/node` version `11.0.0-rc.0` or later, or [`@sentry/cloudflare@^11.0.0-rc.1` when running on Cloudflare](./cloudflare). Browser runtimes are not supported.

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.

l: Maybe we should wait 1 day and just move it to v11 right away?

Suggested change
- `@sentry/node` version `11.0.0-rc.0` or later, or [`@sentry/cloudflare@^11.0.0-rc.1` when running on Cloudflare](./cloudflare). Browser runtimes are not supported.
- `@sentry/node` or `@sentry/cloudflare` version `11.0.0` or later. Browser runtimes are not supported.

@@ -0,0 +1,122 @@
---

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.

q: Do we already have flue prepared to be part of platformicons? Would be nice to have a dedicated logo there

Image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yah will open it separately


Create a file that calls `Sentry.init()` and registers the Flue instrumentation. Flue is instrumented by registering with it rather than by patching, so this `instrument()` call is what connects the two:

```typescript {filename:sentry-init.ts}

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.

l/q: Shouldn't this rather be instrumentation.ts or instrument.server.ts or something like that? Never seen sentry-init.ts before

@RulaKhaled RulaKhaled Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

oh true renamed to instrument.ts


export const cloudflare = extend({
wrap: (Final) =>
Sentry.instrumentDurableObjectWithSentry(

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.

q: Do we need to wrap this? The Vite plugin should automatically instrument it actually. We would only need our Vite plugin and a instrument.server.ts - if it doesn't work we have to fix it, but could leave it as a first step.

This branch was successfully deployed

2 active (1 outdated) deployments
Preview – sentry-docs 0f11a1b4 Deployed Sep 22, 2026 by vercel[bot]
Preview – develop-docs b34b8a01 Deployed Sep 22, 2026 by vercel[bot]
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.

2 participants