-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.45.0
Framework Version
Node 20.18.1
Link to Sentry event
No response
Reproduction Example/SDK Setup
import {
EventHint,
NodeClient,
Scope,
defaultStackParser,
getDefaultIntegrations,
makeNodeTransport,
} from "@sentry/node";
import { Env } from "./config";
import { NodeEnv } from "./consts";
const TraycerScope: Scope = new Scope();
export function initSentry() {
// filter integrations that use the global variable
const integrations = getDefaultIntegrations({}).filter(
(defaultIntegration) => {
return ![
"OnUnhandledRejection",
"OnUncaughtException",
"CaptureConsole",
].includes(defaultIntegration.name);
},
);
const client = new NodeClient({
dsn: "DSN",
integrations: integrations,
beforeSend(event) {
for (const ex of event?.exception?.values ?? []) {
for (const frame of ex.stacktrace?.frames ?? []) {
if (frame.filename?.includes(Env.extensionName)) {
return event;
}
}
}
return null;
},
tracesSampleRate: 0.2,
profilesSampleRate: 1.0,
sampleRate: 1.0,
attachStacktrace: true,
environment: Env.nodeEnv,
includeLocalVariables: true,
serverName: "traycer-vscode",
transport: makeNodeTransport,
stackParser: defaultStackParser,
});
TraycerScope.setTag("extention", Env.extensionName);
TraycerScope.setClient(client);
client.init();
}
export function captureException(
ex: unknown,
hint?: EventHint | undefined,
): unknown {
if (Env.nodeEnv === NodeEnv.Production) {
TraycerScope.captureException(ex, hint);
}
return ex;
}
export function setScopeTag(key: string, value: string) {
TraycerScope.setTag(key, value);
}
export async function close() {
await TraycerScope.getClient()?.close(2000);
}Steps to Reproduce
- Build VS Code extension having Sentry configured using esbuild
- Install the extension
- Observe the CPU usage
Expected Result
It should work normally without any additional memory / cpu load.
Actual Result
When the extension (having sentry) is installed in VS Code, it blocks the event loop in the Extension Host, causing high CPU and memory usage that ultimately results in an Extension Host crash.
- A CPU profile indicates that the package
require-in-the-middle(brought in by@opentelemetry/instrumentationunder@sentry/node) is loaded as soon as the extension activates. - This package seems to block the event loop, rendering the Extension Host unresponsive.
- After removing Sentry from the extension’s dependencies, the Extension Host resumed normal performance without CPU or memory overload.
Metadata
Metadata
Assignees
Projects
Status
Waiting for: Community