Is there an existing issue for this?
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
https://lisa-tk.sentry.io/explore/traces/trace/6dd111760bb8edb07b37883a9d35b9db/?node=span-68cf894ebe343333
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
Is there an existing issue for this?
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
https://lisa-tk.sentry.io/explore/traces/trace/6dd111760bb8edb07b37883a9d35b9db/?node=span-68cf894ebe343333
Reproduction Example/SDK Setup
Steps to Reproduce
Returning false in tracesSampler sends the trace/span to Sentry anyways. In the URL you can see the attribute
removeSampleset totrue. 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