From 0c85ade304329b963452cef1d1765ff90dd786ec Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 09:30:55 +0000 Subject: [PATCH 1/3] docs(cloudflare): Document the isStreamingResponse option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Jan VamPeer Stöcklmair --- .../common/configuration/options.mdx | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/platforms/javascript/common/configuration/options.mdx b/docs/platforms/javascript/common/configuration/options.mdx index 37153b6370c62..e9344c3a3a31a 100644 --- a/docs/platforms/javascript/common/configuration/options.mdx +++ b/docs/platforms/javascript/common/configuration/options.mdx @@ -614,6 +614,32 @@ Propagation over `stub.fetch()` and service binding `fetch()` uses HTTP headers, + + +Decides whether the response of a `fetch` handler is still streaming after the handler returns. For streamed responses, the SDK keeps the `http.server` span open until the whole body is sent, so spans created while the body streams stay inside the request. + +- `true`: The SDK passes the body through a `TransformStream` and ends the span once the body is sent. +- `false`: The SDK ends the span when the handler returns and sends the response unchanged. +- `undefined`: The SDK decides. Server-Sent Events, NDJSON, and `application/stream+json` responses count as streamed, and so do `text/plain` and `text/x-component` (React Server Components) responses without a `Content-Length` header. + +HTML responses don't count as streamed by default, because a buffered HTML response has no `Content-Length` header either. If you render pages with streaming SSR, return `true` for them: + +```typescript {filename:instrument.server.ts} +import { defineCloudflareOptions } from "@sentry/cloudflare"; + +export default defineCloudflareOptions((env) => ({ + dsn: env.SENTRY_DSN, + isStreamingResponse: (response) => + response.headers.get("content-type")?.startsWith("text/html") + ? true + : undefined, +})); +``` + +The function must be synchronous and must not read the response body. Base the decision on the status, the headers, or the request URL. If the function throws, the SDK falls back to its default detection. + + + From e666231ca25120bfe83e6266a733355779d3e3ae Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2026 14:19:37 +0000 Subject: [PATCH 2/3] docs(cloudflare): Trim the isStreamingResponse description --- .../javascript/common/configuration/options.mdx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/platforms/javascript/common/configuration/options.mdx b/docs/platforms/javascript/common/configuration/options.mdx index e9344c3a3a31a..604cd01a07776 100644 --- a/docs/platforms/javascript/common/configuration/options.mdx +++ b/docs/platforms/javascript/common/configuration/options.mdx @@ -616,13 +616,9 @@ Propagation over `stub.fetch()` and service binding `fetch()` uses HTTP headers, -Decides whether the response of a `fetch` handler is still streaming after the handler returns. For streamed responses, the SDK keeps the `http.server` span open until the whole body is sent, so spans created while the body streams stay inside the request. +Tells the SDK whether a response is streamed, so the request span stays open until the whole response is sent. Return `true` for streamed responses, `false` for buffered ones, or `undefined` to let the SDK decide. -- `true`: The SDK passes the body through a `TransformStream` and ends the span once the body is sent. -- `false`: The SDK ends the span when the handler returns and sends the response unchanged. -- `undefined`: The SDK decides. Server-Sent Events, NDJSON, and `application/stream+json` responses count as streamed, and so do `text/plain` and `text/x-component` (React Server Components) responses without a `Content-Length` header. - -HTML responses don't count as streamed by default, because a buffered HTML response has no `Content-Length` header either. If you render pages with streaming SSR, return `true` for them: +By default, the SDK treats Server-Sent Events, NDJSON, and React Server Components responses as streamed, but not HTML. If you stream HTML with SSR, return `true` for it: ```typescript {filename:instrument.server.ts} import { defineCloudflareOptions } from "@sentry/cloudflare"; @@ -636,7 +632,7 @@ export default defineCloudflareOptions((env) => ({ })); ``` -The function must be synchronous and must not read the response body. Base the decision on the status, the headers, or the request URL. If the function throws, the SDK falls back to its default detection. +The function must be synchronous and must not read the response body. From 42e606e37b40214bf4f53a773d9da52f04fedc99 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2026 14:23:01 +0000 Subject: [PATCH 3/3] docs(cloudflare): Use the reviewer's wording for isStreamingResponse --- docs/platforms/javascript/common/configuration/options.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/platforms/javascript/common/configuration/options.mdx b/docs/platforms/javascript/common/configuration/options.mdx index 604cd01a07776..b7fb1ef0b70d9 100644 --- a/docs/platforms/javascript/common/configuration/options.mdx +++ b/docs/platforms/javascript/common/configuration/options.mdx @@ -616,9 +616,9 @@ Propagation over `stub.fetch()` and service binding `fetch()` uses HTTP headers, -Tells the SDK whether a response is streamed, so the request span stays open until the whole response is sent. Return `true` for streamed responses, `false` for buffered ones, or `undefined` to let the SDK decide. +Overrides whether Sentry treats a `fetch` response as streaming. Use this if your application streams responses, such as HTML rendered with streaming SSR, that Sentry doesn't detect automatically. -By default, the SDK treats Server-Sent Events, NDJSON, and React Server Components responses as streamed, but not HTML. If you stream HTML with SSR, return `true` for it: +Return `true` to keep the request span open until streaming completes, `false` to end it when the handler returns, or `undefined` to use automatic detection. ```typescript {filename:instrument.server.ts} import { defineCloudflareOptions } from "@sentry/cloudflare"; @@ -632,7 +632,7 @@ export default defineCloudflareOptions((env) => ({ })); ``` -The function must be synchronous and must not read the response body. +The callback receives the response and request. It must be synchronous and must not read the response body.