Repository navigation
feat(cloudflare): Add incoming request span options to httpServerIntegration - #25582
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f8fed4d. Configure here.
size-limit report 📦Compared: 49af3dc (PR test merge using develop at 8783c2f) Against: 3aafe9e (develop) · base run #63222
|
97cb62a to
a96f52e
Compare
a96f52e to
2ceb825
Compare
2ceb825 to
227d2e4
Compare
JPeer264
left a comment
There was a problem hiding this comment.
Code looks good overall. Just not approving yet until the one comment is clarified
227d2e4 to
9703086
Compare
Optional E2E testsAll optional checks were successful. 32 successful. See the run. Successful checks
|
9703086 to
3dc6a19
Compare
3dc6a19 to
8e70a78
Compare
8e70a78 to
0df3e5e
Compare
47f73c6 to
931b7ed
Compare
931b7ed to
6d40485
Compare
6d40485 to
b6688e3
Compare
…egration` Cloudflare's `httpServerIntegration` took only the body capture options. A user could not skip spans for one route, such as a health check, or change the request span from the request or the response. Node, Deno and Bun all allow this. `httpServerIntegration` now accepts `ignoreIncomingRequests`, `ignoreStaticAssets`, `spans`, `onSpanCreated` and `onSpanEnd`. They use the same names and behavior as `denoServeIntegration` and `bunServerIntegration`, and the callbacks receive the web `Request`. The shared `ServerRequestOptions` check for Cloudflare now lists only the session options, which a worker cannot support because it has no long-lived process to run the flush timer. When the SDK skips the span, it still continues the incoming trace, attaches request data and the body, and captures errors. It also still waits for a streamed response to finish before it flushes. For a streamed response, `onSpanEnd` runs when the stream finishes. It does not run when the handler throws. A callback that throws does not fail the request. `ignoreRequestBody` also no longer fails the request when it throws. The SDK skips the body instead, so it cannot leak data that the filter was meant to hide. Deno and Bun already do this. Two defaults change behavior: - `ignoreStaticAssets` defaults to `true`, so `GET` requests for files such as `favicon.ico` or `*.js` no longer create spans. - `spans` defaults to the client's tracing configuration, so the SDK no longer starts request spans when tracing is disabled. Fixes #25573 Fixes JS-3971 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
b86bf07 to
a99c254
Compare

Cloudflare's
httpServerIntegrationtook only the body capture options. A user could not skip spans for one route, such as a health check, or change the request span from the request or the response. Node, Deno and Bun all allow this.httpServerIntegrationnow acceptsignoreIncomingRequests,ignoreStaticAssets,spans,onSpanCreatedandonSpanEnd. They use the same names and behavior asdenoServeIntegrationandbunServerIntegration, and the callbacks receive the webRequest. The sharedServerRequestOptionscheck for Cloudflare now lists only the session options, which a worker cannot support because it has no long-lived process to run the flush timer.When the SDK skips the span, it still continues the incoming trace, attaches request data and the body, and captures errors. It also still waits for a streamed response to finish before it flushes. For a streamed response,
onSpanEndruns when the stream finishes. It does not run when the handler throws. A callback that throws does not fail the request.ignoreRequestBodyalso no longer fails the request when it throws. The SDK skips the body instead, so it cannot leak data that the filter was meant to hide. Deno and Bun already do this.Two defaults change behavior:
ignoreStaticAssetsdefaults totrue, soGETrequests for files such asfavicon.icoor*.jsno longer create spans.spansdefaults to the client's tracing configuration, so the SDK no longer starts request spans when tracing is disabled.Fixes #25573
Fixes JS-3971