serverless: execution_duration_in_millis value seems wrong
- [x] Review the documentation: https://docs.sentry.io/
- [x] Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- [x] Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- [x] Provide a link to the affected event from your Sentry account
https://sentry.io/organizations/th3rdwave/issues/2169533910/?project=93342&query=is%3Aunresolved
Package + Version
- [ ]
@sentry/browser - [ ]
@sentry/node - [ ]
raven-js - [ ]
raven-node(raven for node) - [x] other: @sentry/serverless
Version:
6.0.1
Description
I expect the value for execution_duration_in_millis to be the duration of the execution before the error occurred, but currently it shows the time since this particular AWS lambda runtime env is up (lambda reuses instances until they are inactive for some time). You can see it in the event linked, time remaining is 27s, execution time is a very large number.
Looking at the code the start time is set only when the handler is created which is only once when the instance is created. Not sure if this is by design but I would expect it to be since the function execution started, until the error / message is logged. In this case start time should be set inside the handler function.
I'm also a little confused by these numbers. My lambda has a timeout value of 29s.
Then I see these numbers in sentry for the "Possible function timeout: ..." error:
execution_duration_in_millis | 30850.07735500112
remaining_time_in_millis | 28997
We have the same issue. Due to our use-case lambda instances are re-used quite often, resulting in these numbers (function timeout is set to 30s):
execution_duration_in_millis | 1878377.7207009995
remaining_time_in_millis | 29998
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
I have the same problem. Real execution time was around 6000ms but in Sentry I get:
execution_duration_in_millis | 12266.522560999729
remaining_time_in_millis | 29991
In code I set
{timeoutWarningLimit: 30000}
I've seen this when it's related to memory. Try increasing the allocated memory for the lambda.