Skip to content

ref(node)!: Consolidate httpIntegration options - #23443

Merged
RulaKhaled merged 9 commits into
developfrom
rolaabuhasna/js-3035-consolidate-the-various-http-integration-options-into-one
Aug 25, 2026
Merged

ref(node)!: Consolidate httpIntegration options#23443
RulaKhaled merged 9 commits into
developfrom
rolaabuhasna/js-3035-consolidate-the-various-http-integration-options-into-one

Conversation

@RulaKhaled

@RulaKhaled RulaKhaled commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

httpIntegration now uses the same option names as httpServerIntegration / httpServerSpansIntegration and the other server SDKs. After #23396, incoming instrumentation.* hooks were already gone; this PR finishes the leftover public API: flatten outgoing instrumentation into first-class hooks, and drop the long aliases that only existed on httpIntegration.

Fixes #22255

Why

The public httpIntegration surface had long names (trackIncomingRequestsAsSessions, maxIncomingRequestBodySize, …) mapped 1:1 onto shorter names already used by the sub-integrations, Bun, Deno, and Cloudflare. Those aliases were leftover from the OTEL HttpInstrumentation era; they were never deprecated, and v11 is the point to collapse them rather than carry both.

Incoming instrumentation.{requestHook,responseHook,applyCustomAttributesOnSpan} already all ran at span create after dropping OTEL, which is why #23396 collapsed them to onSpanCreated. Outgoing still has real request vs response timing, so those become outgoingRequestHook / outgoingResponseHook / outgoingRequestApplyCustomAttributes instead of staying nested.

Nuxt's httpIntegration override is dropped with them. It flushed on every outgoing HTTP response, which is the wrong place: the serverless freeze happens at the end of the incoming request, and patchEventHandler already flushes there after the Nitro handler. On platforms without waitUntil, the old hook also started an extra 2s flush per outbound request.

Nuxt also stops pre-resolving defaultIntegrations. That line only existed to filter out Http and splice the customized integration back in, so removing the override left it doing nothing but harm: it computed the list from the raw options, pinning integration selection before initNode resolves SENTRY_TRACES_SAMPLE_RATE. Anyone enabling tracing purely through the environment silently lost every performance integration, while the channel injection inside initNode was still gated on the resolved value.

@linear-code

linear-code Bot commented Aug 17, 2026

Copy link
Copy Markdown

JS-3035

JS-3427

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 28.57 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.5 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.52 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.43 kB - -
@sentry/browser (incl. Tracing, Replay) 87.89 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.35 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.59 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.3 kB - -
@sentry/browser (incl. Feedback) 45.81 kB - -
@sentry/browser (incl. sendFeedback) 33.36 kB - -
@sentry/browser (incl. FeedbackAsync) 38.47 kB - -
@sentry/browser (incl. Metrics) 29.52 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.45 kB - -
@sentry/react 30.33 kB - -
@sentry/react (incl. Tracing) 50.71 kB - -
@sentry/vue 35.64 kB - -
@sentry/vue (incl. Tracing) 50.73 kB - -
@sentry/svelte 28.6 kB - -
CDN Bundle 30.32 kB - -
CDN Bundle (incl. Tracing) 49.02 kB - -
CDN Bundle (incl. Logs, Metrics) 32.54 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.89 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.91 kB - -
CDN Bundle (incl. Tracing, Replay) 86.47 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.22 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.17 kB - -
CDN Bundle - uncompressed 89.94 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.64 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.23 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.33 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.18 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.92 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.6 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.62 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.28 kB - -
@sentry/nextjs (client) 53.23 kB - -
@sentry/sveltekit (client) 48.92 kB - -
@sentry/core/server 65.11 kB - -
@sentry/core/browser 52.27 kB - -
@sentry/node 121.65 kB +3.42% +4.01 kB 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.18 kB - -
@sentry/node - without tracing 87.46 kB +6.44% +5.29 kB 🔺
@sentry/aws-serverless 95.86 kB +4.63% +4.24 kB 🔺
@sentry/cloudflare (withSentry) - minified 196.9 kB - -
@sentry/cloudflare (withSentry) 487.47 kB - -

View base workflow run

@RulaKhaled

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot 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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fc42fd3. Configure here.

Comment thread packages/nuxt/src/server/sdk.ts Outdated
@RulaKhaled
RulaKhaled force-pushed the rolaabuhasna/js-3035-consolidate-the-various-http-integration-options-into-one branch 2 times, most recently from 0dcceac to c1f4d06 Compare August 19, 2026 09:50
Base automatically changed from feat/node-http-v11-cleanup to develop August 20, 2026 09:56
@RulaKhaled
RulaKhaled force-pushed the rolaabuhasna/js-3035-consolidate-the-various-http-integration-options-into-one branch 3 times, most recently from 1cbbdc4 to a8d5090 Compare August 20, 2026 17:06
@RulaKhaled
RulaKhaled marked this pull request as ready for review August 20, 2026 17:07
@RulaKhaled
RulaKhaled requested review from a team as code owners August 20, 2026 17:07
@RulaKhaled
RulaKhaled requested review from JPeer264, chargome, isaacs and s1gr1d and removed request for a team August 20, 2026 17:07
@RulaKhaled RulaKhaled self-assigned this Aug 24, 2026

@isaacs isaacs 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.

This looks great. Some really minor suggestions, if you agree, but this is overall just a nice improvement.

propagateTraceInOutgoingRequests: options.tracePropagation ?? true,
// oxlint-disable-next-line typescript/no-deprecated -- deprecated alias kept until removal
createSpansForOutgoingRequests: spans,
propagateTrace: options.tracePropagation ?? true,

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.

I think this might be the time (or another follow-up) to pick one: propagateTrace or tracePropagation. (Removing propagateTraceInOutgongRequests is good! But may as well go all the way.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment thread packages/node/src/integrations/http/SentryHttpInstrumentation.ts Outdated
@RulaKhaled
RulaKhaled force-pushed the rolaabuhasna/js-3035-consolidate-the-various-http-integration-options-into-one branch from 1475f9a to b0af040 Compare August 25, 2026 12:01
RulaKhaled and others added 5 commits August 25, 2026 14:01
Public option names now match httpServerIntegration / httpServerSpansIntegration. Nested instrumentation hooks are first-class outgoing hooks instead of a leftover OTEL-era nest.

Fixes #22255
Serverless freeze happens at the end of the incoming request, which onSpanCreated and Nitro's event-handler patch already cover. Flushing again on each outbound response starts extra 2s flushes on platforms without waitUntil.
patchEventHandler already flushes after the Nitro handler. The onSpanCreated hook ran at span start, before the request had events to send.

Co-Authored-By: Cursor Grok 4.6 <cursoragent@cursor.com>
Precomputing them here pinned the selection to the raw options, before
`initNode` resolves `SENTRY_TRACES_SAMPLE_RATE`. Anyone enabling tracing
purely through the environment got `hasSpansEnabled() === false` at this
call site and lost every performance integration, while the channel
injection inside `initNode` was still gated on the resolved value.

Now that the Http override is gone there is nothing left to customize,
so the whole array can be left to `initNode`.
`httpServerSpansIntegration` only instruments incoming requests, so pointing
its migration note at `outgoingRequestHook` and friends sent readers looking
for options that integration does not have. Those live on `httpIntegration`.

Also drops the before/after block under the consolidation table. It restated
every row it sat under, and the sibling "Removed option" table for
`@sentry/nextjs` carries no example either.
RulaKhaled and others added 4 commits August 25, 2026 14:01
…mple

`instrumentation.requestHook` ran for incoming and outgoing spans in v10, so a
reader migrating an outgoing hook would copy the sample onto `onSpanCreated`
and get a hook that never fires for client spans.

Restores the consolidation before/after block dropped earlier in this branch.
`outgoingRequestHook`, `outgoingResponseHook` and
`outgoingRequestApplyCustomAttributes` had no coverage after #23396 dropped the
incoming `instrumentation.*` assertions without replacing the outgoing side.

Each hook derives its attribute from the objects it is handed, so a hook wired
to the wrong span, request or response fails rather than passing silently.
It was an intersection of the outgoing options with nine deprecated no-ops.
Removing those collapsed it into a bare alias of
`OutgoingHttpRequestInstrumentationOptions`, leaving two names for one type —
and the surviving name points at `SentryHttpInstrumentation`, an export that no
longer exists.

Neither name is re-exported from `@sentry/node`, so this is internal only.
…ssage

The real Node request/response objects already satisfy the core minimal types, so the unions were redundant. Cast at the core boundary because those hooks are typed as HttpClientRequest / HttpIncomingMessage.

Co-Authored-By: Cursor Grok 4.6 <cursoragent@cursor.com>
@RulaKhaled
RulaKhaled force-pushed the rolaabuhasna/js-3035-consolidate-the-various-http-integration-options-into-one branch from b0af040 to 7ef796f Compare August 25, 2026 12:01
@RulaKhaled
RulaKhaled merged commit fde8099 into develop Aug 25, 2026
271 of 273 checks passed
@RulaKhaled
RulaKhaled deleted the rolaabuhasna/js-3035-consolidate-the-various-http-integration-options-into-one branch August 25, 2026 12:16
Sign up for free to 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.

Consolidate the various HTTP integration options into one

2 participants