You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0df3e5e
Browse filesBrowse the repository at this point in the historyBrowse files
feat(cloudflare): Add incoming request span options to httpServerIntegration
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>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,12 @@ Work in this release was contributed by @adityareddy-dev, @jpdefo, @Jxxunnn, @ph
63
63
64
64
`httpIntegration` and `httpServerSpansIntegration` now accept `onSpanEnd`, a hook that runs when the response for an incoming request finishes, before its span ends. Use it to change the span based on the response. Deno and Bun already have this option.
65
65
66
+
- **feat(cloudflare): Add incoming request span options to `httpServerIntegration`**
67
+
68
+
Cloudflare's `httpServerIntegration` now accepts `ignoreIncomingRequests`, `ignoreStaticAssets`, `spans`, `onSpanCreated` and `onSpanEnd`, with the same meaning as in the Node, Deno and Bun integrations. The callbacks receive the web `Request`.
69
+
70
+
`ignoreStaticAssets` defaults to `true`, so workers no longer create spans for `GET` requests to common static assets such as `favicon.ico`, `robots.txt` or `*.js` files. To keep these spans, set `httpServerIntegration({ ignoreStaticAssets: false })`. Request spans also follow the client's tracing configuration by default, so the SDK does not start them when tracing is disabled. If `ignoreRequestBody` throws, the request no longer fails, and the SDK skips the body.
0 commit comments