Skip to content

feat(core): HTTP server diagnostics channel utility - #20779

Merged
isaacs merged 5 commits into
developfrom
isaacschlueter/portable-http-integration-server
May 13, 2026
Merged

feat(core): HTTP server diagnostics channel utility#20779
isaacs merged 5 commits into
developfrom
isaacschlueter/portable-http-integration-server

Conversation

@isaacs

@isaacsisaacs commented May 9, 2026

Copy link
Copy Markdown
Member
  • Portable connect integration logic de-OTel-ified and moved into core, for use in bun/deno. (Similar to previous Express integration migration.)
  • Add HTTP server-spans subscription utility to core.
  • Use this utility in node-core and node-core/light.

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).
  • Link an issue if there is one related to your pull request. If no issue is linked, one will be auto-generated and linked.

Closes #issue_link_here

@isaacs
isaacs requested a review from a team as a code ownerMay 9, 2026 18:23
Comment threadpackages/core/src/integrations/http/server-subscription.ts Outdated
Comment threadpackages/core/src/integrations/http/server-subscription.ts Outdated
Comment threadpackages/core/src/integrations/http/server-span-subscription.ts Outdated
@github-actions

github-actionsBot commented May 9, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser26.89 kB--
@sentry/browser - with treeshaking flags25.33 kB--
@sentry/browser (incl. Tracing)44.79 kB--
@sentry/browser (incl. Tracing + Span Streaming)46.8 kB--
@sentry/browser (incl. Tracing, Profiling)49.78 kB--
@sentry/browser (incl. Tracing, Replay)84.43 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags73.86 kB--
@sentry/browser (incl. Tracing, Replay with Canvas)89.13 kB--
@sentry/browser (incl. Tracing, Replay, Feedback)101.77 kB--
@sentry/browser (incl. Feedback)44.08 kB--
@sentry/browser (incl. sendFeedback)31.7 kB--
@sentry/browser (incl. FeedbackAsync)36.81 kB--
@sentry/browser (incl. Metrics)27.98 kB--
@sentry/browser (incl. Logs)28.13 kB--
@sentry/browser (incl. Metrics & Logs)28.8 kB--
@sentry/react28.64 kB--
@sentry/react (incl. Tracing)47.06 kB--
@sentry/vue31.82 kB--
@sentry/vue (incl. Tracing)46.67 kB--
@sentry/svelte26.91 kB--
CDN Bundle29.28 kB--
CDN Bundle (incl. Tracing)47.2 kB--
CDN Bundle (incl. Logs, Metrics)30.65 kB--
CDN Bundle (incl. Tracing, Logs, Metrics)48.34 kB--
CDN Bundle (incl. Replay, Logs, Metrics)69.98 kB--
CDN Bundle (incl. Tracing, Replay)84.6 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)85.66 kB--
CDN Bundle (incl. Tracing, Replay, Feedback)90.41 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)91.5 kB--
CDN Bundle - uncompressed86.14 kB--
CDN Bundle (incl. Tracing) - uncompressed141.7 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed90.33 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed145.16 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed215.16 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed260.41 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed263.85 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed274.11 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed277.54 kB--
@sentry/nextjs (client)49.57 kB--
@sentry/sveltekit (client)45.28 kB--
@sentry/node-core61.97 kB+1.8%+1.09 kB 🔺
@sentry/node166.93 kB+0.55%+906 B 🔺
@sentry/node - without tracing74.38 kB+0.5%+364 B 🔺
@sentry/aws-serverless109.18 kB+1%+1.07 kB 🔺
@sentry/cloudflare (withSentry) - minified170.88 kB--
@sentry/cloudflare (withSentry)431.1 kB--

View base workflow run

@isaacs
isaacs marked this pull request as draft May 9, 2026 18:56
@isaacs
isaacsforce-pushed the isaacschlueter/portable-http-integration-server branch from f1ac205 to 2954cdcCompareMay 9, 2026 20:39
@isaacs
isaacs marked this pull request as ready for review May 9, 2026 21:06

@JPeer264JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got couple of comments. Nice splitting.

Comment threadpackages/core/src/integrations/http/patch-request-to-capture-body.ts Outdated
Comment threadpackages/core/src/integrations/http/patch-request-to-capture-body.ts Outdated
Comment threadpackages/core/src/integrations/http/patch-request-to-capture-body.ts Outdated
Comment threadpackages/core/src/integrations/http/server-span-subscription.ts Outdated
Comment threadpackages/core/src/integrations/http/server-span-subscription.ts Outdated
Comment threadpackages/core/src/integrations/http/record-request-session.ts Outdated
Comment threadpackages/core/src/integrations/connect/index.ts Outdated
Comment threadpackages/core/src/integrations/http/server-subscription.ts Outdated
@isaacs
isaacsforce-pushed the isaacschlueter/portable-http-integration-server branch from 2954cdc to ccd0275CompareMay 12, 2026 19:43
Comment threadpackages/node-core/src/light/integrations/httpIntegration.ts
Comment threadpackages/core/src/integrations/http/server-subscription.ts Outdated
@isaacs
isaacsforce-pushed the isaacschlueter/portable-http-integration-server branch from ccd0275 to c74cb0aCompareMay 12, 2026 23:24
@isaacsisaacs changed the title Portable http.Server integrationfeat(core): HTTP server-spans subscription utilityMay 12, 2026
Comment threadpackages/node-core/src/light/integrations/httpIntegration.ts
Comment threadpackages/core/src/integrations/http/server-subscription.ts Outdated

@JPeer264JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The PR got way smaller now as well 🥳

@isaacsisaacs changed the title feat(core): HTTP server-spans subscription utilityfeat(core): HTTP server diagnostics channel utilityMay 13, 2026
@isaacs
isaacsforce-pushed the isaacschlueter/portable-http-integration-server branch from c74cb0a to 1c4fb59CompareMay 13, 2026 15:34
Comment threadpackages/core/src/integrations/http/server-subscription.ts Outdated
Comment threadpackages/core/src/integrations/http/server-subscription.ts
@isaacs
isaacsforce-pushed the isaacschlueter/portable-http-integration-server branch from 1c4fb59 to 7ef4b27CompareMay 13, 2026 15:56
Comment threadpackages/core/src/integrations/http/server-subscription.ts
Comment threadpackages/core/src/integrations/http/server-subscription.ts Outdated
isaacs added 4 commits May 13, 2026 09:37
Add platform-portable building blocks that server SDKs use to instrument
incoming HTTP requests without depending on OTel HTTP instrumentation:
- `getHttpServerSubscriptions`: diagnostics_channel listener for
`http.server.request.start`, set up isolation scope, request data,
trace continuation, optional body capture and request-session tracking
- if `spans: true` option set, then also creates the root server span
around the request lifecycle, applying static-asset/status-code
filtering, `ignoreIncomingRequests` and `onSpanCreated` hooks
- `recordRequestSession`: release-health session aggregation per request
- `patchRequestToCaptureBody`: opt-in incoming request body capture
Add `kind` field on `StartSpanOptions` so OTel-based SDKs can set
SpanKind on the underlying span, and update `headersToDict` to allow
`number`-valued headers to support Node.js types.
Replace inline `instrumentServer` Proxy/emit-wrapping implementation in
node-light's HTTP integration with core's `getHttpServerSubscriptions`,
which does the same work (isolation scope, request data, body capture,
trace continuation, best-effort transaction name).
Replace inline `instrumentServer` Proxy/emit-wrapping in
`httpServerIntegration.ts` with core's `getHttpServerSubscriptions`.
OTel-specific concerns (header propagation, double-wrap context guard,
`_startSpanCallback` dispatch) move into a `wrapServerEmitRequest`
callback that `instrumentServer` invokes inside the per-request
lifecycle.
Re-export `recordRequestSession` from core so existing test continues
to pass.
Duplicate request-isolation/session/body-capture plumbing removed, logic
now lives in `@sentry/core`'s subscription factory.
`patchRequestToCaptureBody` lives in `@sentry/core` now and both the
light SDK and the OTel-based `httpServerIntegration` consume it from
there.
@isaacs
isaacsforce-pushed the isaacschlueter/portable-http-integration-server branch from 7ef4b27 to b92be48CompareMay 13, 2026 16:37

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b92be48. Configure here.

Comment threadpackages/core/src/utils/request.ts
@isaacs
isaacs enabled auto-merge (squash) May 13, 2026 17:00
@isaacs
isaacs merged commit 7f2aa3d into developMay 13, 2026
522 of 525 checks passed
@isaacs
isaacs deleted the isaacschlueter/portable-http-integration-server branch May 13, 2026 18:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@isaacs@mydea@JPeer264