getsentry / getsentry/sentry-javascript
bun: Outgoing `node:http` / `node:https` requests are not instrumented
- 主要语言
- TypeScript
- 星标
- 8.7k
- 派生
- 1.8k
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 523
描述
Bun publishes none of the `node:diagnostics_channel` http channels that `@sentry/node`'s `httpIntegration` subscribes to.
```
node : ["http.client.request.start","http.server.request.start",
"http.server.response.finish","http.client.response.finish",
"undici:request:create"]
deno : ["http.client.request.created","http.client.request.start",
"http.server.request.start","http.server.response.finish",
"http.client.response.finish"]
bun : []
```
`httpIntegration()` is in Bun's default set (`packages/bun/src/sdk.ts:57`) but does nothing. An end-to-end probe under `bun run` confirms i :
| client | `sentry-trace` sent | child span |
| -- | -- | -- |
| `fetch` | yes | `http.client:GET .../via-fetch` |
| `node:http` | **no** | **none** |
Anything that speaks `node:http` on Bun (axios' http adapter, `got`, `node-fetch@2`, AWS SDK v2, most older clients) drops out of the trace with no warning.
**Work item.** Decide the fix and land it:
* (a) instrument `http.request` / `https.request` directly in a Bun-specific integration, the way `bunHttpServerIntegration` already patches `http.Server.prototype.emit` for the server side, or
* (b) remove `httpIntegration()` from Bun's defaults and warn once at `init()` that `node:http` clients are not traced on Bun.
Either way, add an integration test that asserts the header is or is not sent, so the behavior stops being accidental.
**Prior art ***(tracked)*. [#17779]() (open) reports the root cause from the user side: "Bun not publishing to http Diagnostic Channel", filed against Express on Bun. The other two thirds of the problem are already solved: getsentry/sentry-javascript#22869 (merged) added the Bun `fetch` integration and getsentry/sentry-javascript#22870 (merged) added `bunHttpServerIntegration` for the incoming side. Nothing covers outgoing `node:http`.
贡献指南
调研方向
从 packages/bun/src/sdk.ts:57 开始,检查现有的 bunHttpServerIntegration,它会对服务器端进行 patch。在 bun run 下复现 node:http 的行为,然后选择是对传出请求进行插桩,还是移除默认 integration 并在 init() 中发出警告。添加一个集成测试,断言传出 trace header 的行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- bun, node.js, typescript
- 领域
- backend-api-design, observability, testing
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 50/100