Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve duration accuracy for coldstarts #283

Open
ewindisch opened this issue Aug 10, 2018 · 3 comments
Open

Improve duration accuracy for coldstarts #283

ewindisch opened this issue Aug 10, 2018 · 3 comments

Comments

@ewindisch
Copy link
Contributor

AWS charges and reports the time of a function as including the coldstart initialization time. We do not detect the time spent during initialization and thus do not report this within the duration. This causes duration inaccuracies for coldstarts.

We could add logic that adjusts the duration reported when we're sending a report which is also a coldstart. In this case, we would set the recorded startTime according to the process start time, not when the user's function was invoked.

@ewindisch
Copy link
Contributor Author

There is a nice side effect of the current implementation though... visibility into how much of the time was spent initializing the coldstart vs the code execution. We could maybe capture both of these?

@ewindisch
Copy link
Contributor Author

Recording the coldstart time within auto-tracing might be a solution to showing the initialization time? This is what Xray does iirc.

@ewindisch
Copy link
Contributor Author

Perhaps if it's a coldstart the duration should be reported as simply the process.uptime? (this is expressed as seconds with milliseconds represented via decimal and would need to be converted)

https://nodejs.org/api/process.html#process_process_uptime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant