Repository navigation
ref(core): Drop the internal prefix from tunnel exports - #26746
Conversation
size-limit report 📦Compared: a0c6309 (PR test merge using develop at e9013e0) Against: e9013e0 (develop) · base run #67691 ✅ Baseline matches: this diff contains only this PR's changes.
|
Optional E2E testsSome optional checks were not successful. They do not block the merge. 3 not successful, 66 successful. See the run.
Successful checks
|
andreiborza
left a comment
There was a problem hiding this comment.
Do we want to break these mid-major? I'd rather rename them but keep an export as public api with a todo to remove in v12, even if these are internal packages.
Wdyt?
these do not really seem breaking to me, realistically, I highly doubt anybody is using this other than us? and even then, it could not have been any clearer that they shouldn't xD My reasoning is, if anybody has been using this, and they update the SDK and this breaks, it seems ok to expect them to rename their API usage to omit |
|
Fair, tbh I'm mostly concerned about jr breaking if anything 😅. |
@sentry/core and @sentry/server-utils are internal packages, so the tunnel helpers they share with the SDKs no longer need the _INTERNAL_ prefix. Removes @sentry/node's _INTERNAL_installTunnelHooks, which only wrapped server-utils' instrumentTunnelServers; Next.js and TanStack Start call that directly now. The prefixed exports that stay on SDK entry points are only imported by code our build plugins inject. Co-Authored-By: Francesco Gringl-Novy <[email protected]>
…tTunnelPaths Co-Authored-By: Francesco Gringl-Novy <[email protected]>
8bcc363 to
faf542b
Compare
… helpers (#26744) ## What Cleans up `_INTERNAL_`-prefixed exports from `@sentry/core`: - Removes `INTERNAL_getSegmentSpan`, which no other package uses. - Removes `_INTERNAL_FLAG_BUFFER_SIZE` and `_INTERNAL_MAX_FLAGS_PER_SPAN`, which only the browser and node feature flag integration tests imported. Each test package now defines the limits once. - Renames the log and metric helpers so the names say what they do. The old exported names stay as deprecated aliases (because e.g. electron or react native use them): - `_INTERNAL_captureLog` → `captureLogEvent` - `_INTERNAL_captureMetric` → `captureMetricEvent` - `_INTERNAL_captureSerializedLog` → `bufferSerializedLog` - `_INTERNAL_captureSerializedMetric` → `bufferSerializedMetric` - `_INTERNAL_flushLogsBuffer` → `flushLogsBuffer` - `_INTERNAL_flushMetricsBuffer` → `flushMetricsBuffer` - Renames `_INTERNAL_getLogBuffer` and `_INTERNAL_getMetricBuffer` to `getLogBuffer` and `getMetricBuffer`. They aren't exported from the package, so they get no alias. ## Why This is the first step in cleaning up `_INTERNAL_`-prefixed exports, which only add surface area. Removed symbols are still exported from their own modules, so core keeps using them internally. Electron uses the capture helpers and React Native uses `_INTERNAL_flushLogsBuffer`, so the old names can't go yet. A follow-up can drop the aliases once those SDKs use the new names. The new names avoid two problems with plain `captureLog`/`captureMetric` and `captureSerialized*`: - `capture*Event` runs the full pipeline: enrichment, `beforeSendLog`/`beforeSendMetric`, serialization, then a sink that defaults to the buffer. A bare `captureMetric` would read like a sibling of `captureEvent`/`captureException`, which return an event id and send their own envelope. It would also clash with the local `captureMetric` helpers in core's `metrics/public-api.ts` and in Electron. - `bufferSerialized*` does no processing. It only adds an already processed item to the client's buffer, which is how Electron's main process ingests items from the renderer. `_INTERNAL_getTunnelPaths` was dropped by #26746. `_INTERNAL_resetTunnelDefaults` is test-only, but tests in several packages call it, so it stays. <!-- junior-request-attribution:start --> via @mydea. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0C22CSDV6X%3A1795592302.024799 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C22CSDV6X%3A1795592302.024799) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C22CSDV6X%3A1795592302.024799/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Francesco Gringl-Novy <[email protected]> Co-authored-by: Francesco Gringl-Novy <[email protected]>
What
Drops the
_INTERNAL_prefix from the managed tunnel helpers in@sentry/core,@sentry/core/serverand@sentry/server-utils, and from the tunnel setters that framework build plugins inject (setTunnelDefaultson@sentry/astro/middleware,setTunnelBasePathon@sentry/react-router,setTunnelRouteon@sentry/tanstackstart-react). Removes_INTERNAL_installTunnelHooksfrom@sentry/nodeand_INTERNAL_getTunnelPathsfrom@sentry/core/server.Why
@sentry/coreand@sentry/server-utilsare internal packages, so their exports don't need a prefix to warn users off. The framework tunnel setters aren't brittle enough to warrant one either._INTERNAL_installTunnelHookswas a thin wrapper around server-utils'instrumentTunnelServers. It also leaked into every SDK that re-exports@sentry/node. Next.js and TanStack Start already depend on@sentry/server-utils, so they now call it directly._INTERNAL_getTunnelPathshad no users outside core. ref(core): Drop unused internal exports and rename log/metric capture helpers #26744 removes it as well, so the two PRs make the same change to that line.applyBrowserTunnelDefaultsstays on the main@sentry/coreentry, not/browser, because the frameworks' sharedcommon/tunnel.tsmodules also run at build time and on the server.handleServedNodeTunnelRequest,setNodeTunnelHandler,httpServerHandlesTunnel) stays in core. It shares the request/response conversion withhandleTunnelRequestIfMatched, and core's HTTP server instrumentation reads it from the shared tunnel store.resetTunnelDefaultsis only used by tests, but tests in five packages need it to reset shared state.via @mydea.
--
View Session [Sentry]