ref(server-utils): Move ServerRuntimeClient and node stack parser out of core - #23833
Draft
mydea wants to merge 1 commit into
Draft
Conversation
… of core Moves the base `ServerRuntimeClient` (with `ServerRuntimeClientOptions` / `ServerRuntimeOptions`) and the node stack-trace parser (`nodeStackLineParser`, `node`, `filenameIsInApp`) out of `@sentry/core/server` into `@sentry/server-utils`. Unlike the earlier moves, these two touch a handful of core internals that are not part of core's public API. Rather than expand the public `@sentry/core` surface, those internals are re-exported (mostly `_INTERNAL_`-prefixed, matching the existing convention) from the semi-internal `@sentry/core/server` entrypoint for `@sentry/server-utils` to consume: `normalizeStackTracePath`, `DEFAULT_TRANSPORT_BUFFER_SIZE`, `addUserAgentToTransportHeaders`, `_getTraceInfoFromScope`, and the span-streaming integration name. `ServerRuntimeOptions` was extracted out of the shared `types/options.ts` (which must stay in core for `ClientOptions` etc.) into its own server-utils types file. `@sentry/server-utils` is added as a dependency to `@sentry/node-native` and `@sentry/bundler-plugins`, the only two consumers that did not already depend on it, so they can import `filenameIsInApp` / `nodeStackLineParser` / `ServerRuntimeClient` from there. Every other runtime SDK already depends on server-utils and keeps re-exporting these under the same names, so there is no user-facing change. The moved `ServerRuntimeClient` test's metric-enrichment cases were reworked to drive the `processMetric` client hook directly instead of reaching into the internal metric buffer, so no metric internals had to be exposed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Stacked on #23826 (base branch =
fn/move-server-only-apis-to-server-utils). Thenode-stack-tracemove depends onanralready being out of core, which happens in #23826. Merge #23826 first; the base will retarget todevelopafter.Moves the base
ServerRuntimeClient(+ServerRuntimeClientOptions/ServerRuntimeOptions) and the node stack-trace parser (nodeStackLineParser,node,filenameIsInApp) out of@sentry/core/serverinto@sentry/server-utils, and adds@sentry/server-utilsas a dependency to@sentry/node-nativeand@sentry/bundler-plugins.Exposing core internals (the reason these couldn't move before): unlike the earlier moves, these two import a handful of non-public core internals. Rather than grow the public
@sentry/coreAPI, they're re-exported from the semi-internal@sentry/core/serverentrypoint (mostly_INTERNAL_-prefixed, matching the existing convention there) for server-utils to consume:normalizeStackTracePath(for the stack parser)DEFAULT_TRANSPORT_BUFFER_SIZE,addUserAgentToTransportHeaders,_getTraceInfoFromScope, span-streamingINTEGRATION_NAME(forServerRuntimeClient)Decisions:
ServerRuntimeOptionswas extracted from the sharedtypes/options.ts(which stays in core forClientOptionset al.) into its own server-utils types file.@sentry/node-nativeand@sentry/bundler-pluginswere the only two consumers without a server-utils dependency; they now have one. Every other runtime SDK already depended on server-utils and keeps re-exporting these symbols under the same names, so there is no user-facing change.ServerRuntimeClienttest's metric cases were reworked to drive theprocessMetricclient hook directly rather than reading the internal metric buffer — so no metric internals were exposed (the metric-buffer accessor stays private to core's own metrics tests).