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
9.5.0
Framework Version
No response
Link to Sentry event
Reproduction Example/SDK Setup
Sentry.init({
dsn: 'YOUR_SENTRY_DSN',
release: 'YOUR_SENTRY_RELEASE',
environment: 'YOUR_SENTRY_ENVIRONMENT',
tracesSampleRate: 0.1,
profilesSampleRate: 0.1,
maxValueLength: 2000,
integrations: [
Sentry.rewriteFramesIntegration({ root: process.cwd() }),
Sentry.graphqlIntegration({
ignoreResolveSpans: false,
useOperationNameForRootSpan: true,
}),
Sentry.knexIntegration(),
Sentry.postgresIntegration(),
nodeProfilingIntegration(),
],
_experiments: {
maxSpans: 'YOUR_SENTRY_RELEASE' !== 'prod' ? 10000 : 1000,
},
});
Steps to Reproduce
I'm using Sentry.graphqlIntegration({ useOperationNameForRootSpan: true })
in an AWS Lambda with Apollo Server. According to the documentation, this should rename the root http.server span with the GraphQL operation name.
// instrumentation.ts
Sentry.init({
dsn: 'YOUR_SENTRY_DSN',
release: 'YOUR_SENTRY_RELEASE',
environment: 'YOUR_SENTRY_ENVIRONMENT',
tracesSampleRate: 0.1,
profilesSampleRate: 0.1,
maxValueLength: 2000,
integrations: [
Sentry.rewriteFramesIntegration({ root: process.cwd() }),
Sentry.graphqlIntegration({
ignoreResolveSpans: false,
useOperationNameForRootSpan: true,
}),
Sentry.knexIntegration(),
Sentry.postgresIntegration(),
nodeProfilingIntegration(),
],
_experiments: {
maxSpans: 'YOUR_SENTRY_RELEASE' !== 'prod' ? 10000 : 1000,
},
});
Lambda handler:
import './instrumentation';
export const handleHttp = Sentry.wrapHandler(
async (event: APIGatewayEvent, context: Context) => {
const server = await getServer();
return await server.createHttpHandler({
cors: {
origin: '*',
allowedHeaders: ['sentry-trace', 'baggage'],
credentials: true,
},
})(event, context);
}
);
The issue is that in AWS Lambda, the root span is not http.server
but function.aws.lambda
, so graphqlIntegration never renames it.
Expected Result
-
The root span should be http.server and renamed to include the GraphQL operation name (e.g., POST /graphql (query operationName)).
-
The trace should correctly reflect the operation name in the root span, instead of the default lambda function name.
Actual Result
-
There is no op: http.server span, only function.aws.lambda.
-
graphqlIntegration does not rename the root span name with the graphql operation name. The name of the root operation is the name of the Lambda Function.
Metadata
Metadata
Assignees
Type
Projects
Status