Title: deno: `Deno.serve` does not record request sessions · Issue #25495 · getsentry/sentry-javascript · GitHub
Open Graph Title: deno: `Deno.serve` does not record request sessions · Issue #25495 · getsentry/sentry-javascript
X Title: deno: `Deno.serve` does not record request sessions · Issue #25495 · getsentry/sentry-javascript
Description: denoHttpIntegration records a request session for each incoming node:http request (#22888 turned this on). denoServeIntegration does not record sessions at all. Most Deno apps use Deno.serve, so release health for those apps shows no req...
Open Graph Description: denoHttpIntegration records a request session for each incoming node:http request (#22888 turned this on). denoServeIntegration does not record sessions at all. Most Deno apps use Deno.serve, so re...
X Description: denoHttpIntegration records a request session for each incoming node:http request (#22888 turned this on). denoServeIntegration does not record sessions at all. Most Deno apps use Deno.serve, so re...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25495
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"deno: `Deno.serve` does not record request sessions","articleBody":"`denoHttpIntegration` records a request session for each incoming `node:http` request (getsentry/sentry-javascript#22888 turned this on). `denoServeIntegration` does not record sessions at all. Most Deno apps use `Deno.serve`, so release health for those apps shows no request sessions and no crash-free rate.\n\ngetsentry/sentry-javascript#25492 gives `denoServeIntegration` the other incoming request options from `denoHttpIntegration`. It leaves out `sessions` and `sessionFlushingDelayMS`, because they need more than an option.\n\n## **Proposed options**\n\nUse the same names, defaults and behavior as `denoHttpIntegration`.\n\n\u003c!-- linear:table-colwidths:164,90,90,344 -->\n| **Option** | **Type** | **Default** | **Notes** |\n| -- | -- | -- | -- |\n| `sessions` | `boolean` | `true` | Record a request session for each incoming `Deno.serve` request. |\n| `sessionFlushingDelayMS` | `number` | `60000` | Time until the SDK sends the session aggregate. |\n\n## **Why this is not a plain option**\n\nThe shared helper `recordRequestSession` in `@sentry/core/server` does most of the work. It marks the request as a session on the isolation scope, counts it in a per-minute bucket when the request ends, and sends the aggregate on a timer or on `client.flush()`. `DenoClient` extends `ServerRuntimeClient`, which already sets the session status to `errored` or `crashed` when the SDK captures an exception during the request.\n\nThe problem is how the helper knows that a request ended. It takes a `node:http` response and waits for its `close` event:\n\n```\nrecordRequestSession(client, { requestIsolationScope, response, sessionFlushingDelayMS });\n// inside: response.once('close', () => { /* count the session */ });\n```\n\n`Deno.serve` has no response object with events. The handler returns a web `Response`, and a streamed body can finish long after the handler returns.\n\n## **Suggested approach**\n\n1. Change `recordRequestSession` so it does not need a `node:http` response. For example, split it into a start step that returns an `end()` function. Node and `denoHttpIntegration` call `end()`from the response `close` event, so their behavior does not change.\n2. In `packages/deno/src/wrap-deno-request-handler.ts`, start the session for each request when `sessions` is on. Call `end()` when the response finishes:\n * For a normal response, after the handler returns.\n * For a streamed response, when the stream finishes. The `onEnd` callback that getsentry/sentry-javascript#25492 added to `streamResponse` already runs at this point.\n * When the handler throws, after `captureException`, so the session counts as `crashed`.\n3. Sessions do not depend on tracing. They must work when the SDK skips the span, for example with `spans: false`, `ignoreIncomingRequests`, a static asset, or tracing turned off. Today `streamResponse` takes a span, so the stream end needs a code path that works without one.\n\nA fake response object that emits `close` would also work, but it hides the real contract and is easy to break.\n\n## **Decisions needed**\n\n* **OPTIONS and HEAD requests.** The wrapper returns early for these methods. Core's `node:http` code records a session for every request, including these. Match Node unless there is a reason not to.\n* **Changelog.** With `sessions` defaulting to `true`, `Deno.serve` apps start to send session aggregates after an upgrade. This needs a note.\n\n## **Tests**\n\nAdd tests to `packages/deno/test/deno-serve.test.ts`. Use a test transport and call `client.flush()`to send the aggregate.\n\n* A successful request counts as `exited`.\n* A handled `captureException` in the handler counts as `errored`.\n* A thrown error counts as `crashed`.\n* `sessions: false` sends no session.\n* A streamed response counts only after the stream finishes.\n* Sessions are recorded when tracing is off and when the span is skipped.\n\n## **Related**\n\n* `Bun.serve` (`bunServerIntegration`) also records no request sessions. The same `recordRequestSession` change would help there.","author":{"url":"https://github.com/isaacs","@type":"Person","name":"isaacs"},"datePublished":"2026-10-18T23:01:30Z","url":"https://github.com/getsentry/sentry-javascript/issues/25495"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cb9e5efd-9034-fcd1-a4ec-9abd063a02ad |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F80:10BC16:1F74D5:2A5150:6B04319F |
| html-safe-nonce | 09760c38538b0278f678ea4e104c83c2089e340d97f216cb9b872816e0ea0c35 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjgwOjEwQkMxNjoxRjc0RDU6MkE1MTUwOjZCMDQzMTlGIiwidmlzaXRvcl9pZCI6IjMwMTgyMDQ5OTgyMzM1MDIxMTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b24cbd8b8aaacf06d0e3b2d06633226fefe05c1a7d456a5dff53180baec165b1 |
| hovercard-subject-tag | issue:5915076314 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25495/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7ebbe2dc332b17a266f20322204b7e2009e19ad352d73fd6758da56c6d86966a/getsentry/sentry-javascript/issues/25495 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7ebbe2dc332b17a266f20322204b7e2009e19ad352d73fd6758da56c6d86966a/getsentry/sentry-javascript/issues/25495 |
| og:image:alt | denoHttpIntegration records a request session for each incoming node:http request (#22888 turned this on). denoServeIntegration does not record sessions at all. Most Deno apps use Deno.serve, so re... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | isaacs |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width