sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

serverless: execution_duration_in_millis value seems wrong

Open janicduplessis opened this issue 5 years ago • 5 comments

  • [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.

janicduplessis avatar Jan 22 '21 20:01 janicduplessis

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

montanaflynn avatar Jan 25 '21 14:01 montanaflynn

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

konstantinkoeppe avatar Sep 14 '21 07:09 konstantinkoeppe

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 🥀

github-actions[bot] avatar Oct 21 '21 18:10 github-actions[bot]

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}

pierot avatar Apr 04 '22 19:04 pierot

I've seen this when it's related to memory. Try increasing the allocated memory for the lambda.

SouthBelair avatar Apr 08 '23 15:04 SouthBelair