getsentry / getsentry/sentry-javascript

bun: `Bun.serve` does not support streaming responses

未关闭
#23,883 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Bug Bun javascript Spans
主要语言
TypeScript
星标
8.7k
派生
1.8k
平均合并
1 天 17 小时
30 天内合并 PR
523

描述

`wrapRequestHandler` in `packages/bun/src/integrations/bunserver.ts:189` uses `startSpan`, which ends the span as soon as the handler returns. Deno (`streamResponse`) and Cloudflare (`classifyResponseStreaming` plus a `TransformStream`) both keep the span open until the body finishes.

An SSE or LLM streaming route on Bun reports a span duration covering only the handler, not the stream. This is the common shape for AI apps, which are a large part of the Bun audience.

**Work item.** Move `classifyResponseStreaming` into `@sentry/core` or `@sentry/server-utils` (see D10) and adopt it in `bunserver.ts` with `startSpanManual`.

贡献指南

打开贡献指南

调研方向

Start in packages/bun/src/integrations/bunserver.ts:189 at wrapRequestHandler and compare the Deno streamResponse and Cloudflare classifyResponseStreaming plus TransformStream implementations. Review the D10 proposal for placing classifyResponseStreaming, then verify with a streaming response that the span remains open until the body finishes rather than ending when the handler returns.

由索引模型根据 Issue 内容生成。

评估

技术栈
bun, typescript
领域
backend, observability
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
65/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。