alexcasalboni / aws-lambda-power-tuning

AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced.
Apache License 2.0
5.29k stars 363 forks source link

Use Billed Duration instead of Duration from logs #199

Closed NeilJed closed 1 year ago

NeilJed commented 1 year ago

Updates extractDuration to use the Billed Duration value rather than Duration from logs for cost calculations. Billed duration is at 1ms resolution and expressed as an integer.

Change reflects the fact that for certain packages/runtimes the init phase is charged for and thus the Billed Duration reflects the true cost of the lambda. See #197

Unit tests updated to reflect the change and modified to use realistic values for given execution times.

alexcasalboni commented 1 year ago

Thank you, @NeilJed 🙏

Tests are succeeding - don't worry about the integration test failing, it seems to be a secrets configuration error on my side.

Will have a closer look later today, but I think this is ready to be merged 🚀

NeilJed commented 1 year ago

@alexcasalboni Were you going to merge this or did you want to solve the Node16 test run first?

alexcasalboni commented 1 year ago

Apologies, it took me a while to jump on this 😃

Merging now 🚀

alexcasalboni commented 1 year ago

This is now published on SAR as version 4.3.1 👌