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/aws-serverless
SDK Version
8.18.0
Framework Version
No response
Link to Sentry event
Reproduction Example/SDK Setup
Initialization code for both Lambda functions:
Sentry.init({
debug: true,
dsn: SENTRY_DSN,
environment: "sandbox",
integrations: [
Sentry.postgresIntegration(),
nodeProfilingIntegration()
],
tracesSampleRate: 1.0,
profilesSampleRate: 1.0,
});
Lambda A:
export const handler = Sentry.wrapHandler(async (event) => {
// Generate ClientContext headers
// Invoke Lambda B with generated ClientContext
// Return a response
});
Lambda B:
export const handler = async (event, context) => {
const { baggage, sentryTrace } = extractFromLambdaClientContextHeaders(context);
return await Sentry.continueTrace({ baggage, sentryTrace }, async () => {
console.log(Sentry.getActiveSpan());
const queryString = "select count(*) from myTable;";
return await Sentry.startSpan({
name: queryString,
op: "db.sql.execute"
}, async (span) => {
console.log(span);
return await executeQuery();
});
});
});
Steps to Reproduce
- Invoke Lambda A, which invokes Lambda B
- Check Traces, in Sentry.io
Expected Result
The trace should record the "db.sql.execute" span as a child span in the trace.
Actual Result
There is no record of the "db.sql.execute" span at all.
In the logs, I can see that continueTrace
creates a nonRecordingSpan
, which is not sent to Sentry. I believe this is the root of the problem. The call to startSpan
appears to create a normal (recording) span, but since it is a child of the non-recording span, it is not sent along to Sentry either.
Metadata
Assignees
Type
Projects
Status
Waiting for: Community
Activity