diff --git a/docs/platforms/javascript/common/configuration/options.mdx b/docs/platforms/javascript/common/configuration/options.mdx index 37153b6370c624..b7fb1ef0b70d9c 100644 --- a/docs/platforms/javascript/common/configuration/options.mdx +++ b/docs/platforms/javascript/common/configuration/options.mdx @@ -614,6 +614,28 @@ Propagation over `stub.fetch()` and service binding `fetch()` uses HTTP headers, + + +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. + +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"; + +export default defineCloudflareOptions((env) => ({ + dsn: env.SENTRY_DSN, + isStreamingResponse: (response) => + response.headers.get("content-type")?.startsWith("text/html") + ? true + : undefined, +})); +``` + +The callback receives the response and request. It must be synchronous and must not read the response body. + + +