getsentry / getsentry/sentry-javascript

bun: Outgoing `node:http` / `node:https` requests are not instrumented

Offen
#23,881 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Bug Bun javascript
Vorherrschende Sprache
TypeScript
Sterne
8.7k
Forks
1.8k
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
523

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start at packages/bun/src/sdk.ts:57 and inspect the existing bunHttpServerIntegration, which patches the server side. Reproduce the node:http behavior under bun run, then choose whether to instrument outgoing requests or remove the default integration and warn at init(). Add an integration test asserting the outgoing trace header behavior.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
bun, node.js, typescript
Bereich
backend-api-design, observability, testing
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
50/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.