-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 - express
SDK Version
10.27.0
Framework Version
Express 5.1.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
No response
Steps to Reproduce
Set tracesSampleRate to 1 and observe memory usage, likely with a lot of Sentry.startSpan() usage.
Expected Result
Memory usage to not keep growing.
Actual Result
Up until 10pm in the screenshot, we were using tracesSampleRate of 1. Then we switched it to 0.2. The dotted lines indicate new deployments (thus resetting memory). We've been having memory leak issues for several versions of @sentry/node now, but we didn't realize until yesterday that the biggest lever that changed this was the tracesSampleRate. The chart unfortunately doesn't show additional memory leaks, but it's consistently been there at high growth rates until now. If there any ideas on why this is happening and how Sentry is affecting this, would be greatly appreciated, as we can see memory usage still growing but just far slower now.
Additional Context
We wrap Sentry methods in our helper functions in case this affects anything:
import * as Sentry from '@sentry/node'
interface ServerSpanArgs {
name: string // human-readable name
op?: string // semantic operation
attributes?: Record<string, string | number | boolean | undefined>
}
export const withServerTrace = async <T>(
{ name, op = 'service', attributes }: ServerSpanArgs,
fn: (span: Sentry.Span) => Promise<T> | T
): Promise<T> => {
return Sentry.startSpan({ name, op, attributes }, async (span) => {
try {
return await fn(span)
} catch (err) {
span.setStatus({ code: 2, message: 'internal_error' })
Sentry.captureException(err)
throw err
}
})
}
export const captureServerException = (
error: unknown,
extra?: Record<string, unknown>
) => {
Sentry.captureException(error, { extra })
}Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Metadata
Metadata
Assignees
Projects
Status