-
-
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 - fastify
SDK Version
9.42.0
Framework Version
No response
Link to Sentry event
Reproduction Example/SDK Setup
Sentry.init({
tracesSampler: ({ attributes, parentSampled }) => {
const { removeSample } = attributes ?? {};
if (removeSample !== undefined && removeSample === true) {
return false;
}
},
});
function cancelSpan() {
Sentry.getActiveSpan()?.setAttribute('removeSample', true);
}
const data = [];
Sentry.startSpan({
name: 'Ingester',
op: 'queue.task',
}, () => {
if (!data.length) {
cancelSpan();
}
});
Steps to Reproduce
Returning false in tracesSampler sends the trace/span to Sentry anyways. In the URL you can see the attribute removeSample
set to true
. I can confirm that the tracesSampler is being invoked but I'm curious as to why spans are being sent when I explicitly return false.
Expected Result
Should filter out trace
Actual Result
Trace shows up in Sentry
Metadata
Metadata
Assignees
Type
Projects
Status
Waiting for: Product Owner