Skip to content

@sentry/serverless adds ~300ms to function duration #3051

Closed
@kostia-official

Description

@kostia-official

Package + Version

"@sentry/node": "^5.27.4",
"@sentry/serverless": "^5.27.4",

Description

I've noticed that the response time of my functions is slow, added tracing, and noticed that at the end of every invocation my lambda sends POST request to sentry. Here you can see a trace:
image

It's okay to increase response time for requests with error, but if there is no error, I expect that response would be sent immediately. There is minimal code that I've tested:

import * as Sentry from '@sentry/serverless';

Sentry.AWSLambda.init({
  dsn: process.env.SENTRY_DSN,
  tracesSampleRate: 1.0
});

export const handler = Sentry.AWSLambda.wrapHandler(
  (event, context, callback) => {
    context.callbackWaitsForEmptyEventLoop = false;

    callback(null, { statusCode: 200 });
  },
  { callbackWaitsForEmptyEventLoop: false, flushTimeout: 2000 }
);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions