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

feat(cli, sdk): resource usage report #4741

Closed
wants to merge 4 commits into from

Conversation

tsuf239
Copy link
Contributor

@tsuf239 tsuf239 commented Oct 31, 2023

Description

closes #4644
As a part of the matrix automation process, we need to figure out what are the methods and properties that are used in each test. I came out with the following approach:

  • collect the inflight methods from the _addOnLift
  • collect the preflight methods and properties by adding a proxy to the Resource class
  • save the collected methods list to a file in the output dir (currently, it may change in the future)

Please let me know what you think :)

TODO:

  • add tests
  • prefix "internal" prelight properties and methods with a "_"

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

@monadabot
Copy link
Contributor

monadabot commented Oct 31, 2023

Console preview environment is available at https://wing-console-pr-4741.fly.dev 🚀

Last Updated (UTC) 2023-10-31 15:49

@monadabot
Copy link
Contributor

monadabot commented Oct 31, 2023

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 126ms±3.55 129ms±4.43 +2ms (+1.77%)⬜
jsii_small.test.w -t sim 1009ms±19.03 1007ms±12.54 -2ms (-0.22%)⬜
jsii_small.test.w -t tf-aws 1238ms±17.57 1274ms±23.64 +36ms (+2.94%)⬜
jsii_big.test.w -t sim 6185ms±70.19 6201ms±104.99 +16ms (+0.26%)⬜
jsii_big.test.w -t tf-aws 6453ms±136.96 6395ms±120.69 -58ms (-0.9%)⬜
functions_10.test.w -t sim 1172ms±27.89 1134ms±11.15 -38ms (-3.22%)⬜
functions_10.test.w -t tf-aws 6700ms±143.69 6894ms±67.12 +194ms (+2.9%)⬜
hello_world.test.w -t sim 1088ms±17.34 1075ms±18.68 -13ms (-1.22%)⬜
hello_world.test.w -t tf-aws 8997ms±92.03 8836ms±82.81 -161ms (-1.79%)⬜
empty.test.w -t sim 1017ms±20.23 1000ms±9.51 -17ms (-1.71%)⬜
empty.test.w -t tf-aws 1258ms±19.84 1266ms±14.37 +7ms (+0.58%)⬜
functions_1.test.w -t sim 1106ms±17.32 1100ms±16.66 -6ms (-0.54%)⬜
functions_1.test.w -t tf-aws 3676ms±120.54 3780ms±146.17 +105ms (+2.85%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 129ms 118ms 138ms 4ms 6ms
jsii_small.test.w -t sim 1007ms 976ms 1032ms 13ms 18ms
jsii_small.test.w -t tf-aws 1274ms 1211ms 1338ms 24ms 33ms
jsii_big.test.w -t sim 6201ms 5946ms 6417ms 105ms 147ms
jsii_big.test.w -t tf-aws 6395ms 6235ms 6770ms 121ms 169ms
functions_10.test.w -t sim 1134ms 1112ms 1158ms 11ms 16ms
functions_10.test.w -t tf-aws 6894ms 6753ms 7010ms 67ms 94ms
hello_world.test.w -t sim 1075ms 1028ms 1106ms 19ms 26ms
hello_world.test.w -t tf-aws 8836ms 8676ms 9095ms 83ms 116ms
empty.test.w -t sim 1000ms 973ms 1017ms 10ms 13ms
empty.test.w -t tf-aws 1266ms 1237ms 1290ms 14ms 20ms
functions_1.test.w -t sim 1100ms 1075ms 1142ms 17ms 23ms
functions_1.test.w -t tf-aws 3780ms 3409ms 4068ms 146ms 204ms
Last Updated (UTC) 2023-10-31 16:05

@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Oct 31, 2023
@@ -176,6 +176,33 @@ export abstract class Resource extends Construct implements IResource {

private readonly onLiftMap: Map<IInflightHost, Set<string>> = new Map();

constructor(scope: Construct, id: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we implement this without adding a dependency on std.Resource? We have some plans to deprecate this class (see #3717)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll need to attach it to whatever class that replaces that- it has to be a parent class for all of the resources (even if it will be empty besides this constructor) should I add a comment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll need to attach it to whatever class that replaces that

You can safely assume every preflight class extends constructs.Construct.

Maybe it's possible to inject this logic in the App's new function? see here:

public new(
fqn: string,
ctor: any,
scope: Construct,
id: string,
...args: any[]
): any {
// delegate to "tryNew" first, which will allow derived classes to inject
const instance = this.tryNew(fqn, scope, id, ...args);
if (instance) {
return instance;
}
// no injection, so we'll just create a new instance
return new ctor(scope, id, ...args);
}

@tsuf239 tsuf239 requested a review from Chriscbr November 6, 2023 07:20
Copy link

Hi,

This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days.
If you need help with the PR, do not hesitate to reach out in the winglang community slack at winglang.slack.com.
Feel free to re-open this PR when it is still relevant and ready to be worked on again.
Thanks!

@github-actions github-actions bot added the Stale label Nov 27, 2023
@tsuf239 tsuf239 removed the Stale label Nov 27, 2023
Copy link

Hi,

This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days.
If you need help with the PR, do not hesitate to reach out in the winglang community slack at winglang.slack.com.
Feel free to re-open this PR when it is still relevant and ready to be worked on again.
Thanks!

@github-actions github-actions bot added the Stale label Dec 18, 2023
@tsuf239 tsuf239 removed the Stale label Dec 18, 2023
@tsuf239
Copy link
Contributor Author

tsuf239 commented Dec 18, 2023

Way too many conflicts. closing that one and opening #5243 instead

@tsuf239 tsuf239 closed this Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"translate" passing tests to supported resources, methods and props
3 participants