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(sdk): aws.QueueRef #6001

Merged
merged 13 commits into from
Mar 19, 2024
Merged

feat(sdk): aws.QueueRef #6001

merged 13 commits into from
Mar 19, 2024

Conversation

eladb
Copy link
Contributor

@eladb eladb commented Mar 19, 2024

Introduce aws.QueueRef as a way to add an external queue reference to an application:

bring aws;
bring cloud;

let myQueue = new aws.QueueRef("arn:aws:sqs:...."); // <-- ARN of an existing SQS queue

new cloud.Function(inflight () => {
  myQueue.push("new message");
});

This works both when running in the simulator and when running on AWS.

The Wing Console also includes some metadata about the queue such as the queue URL and the AWS Console URL:

image

Issues

Misc

Added an option link: bool to ui.FIeld to indicate that the value returned is a link. We should make this a clickable link in the Wing Console.

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.

Introduce `aws.QueueRef` as a way to add an external queue reference to an application:

    bring aws;
    bring cloud;

    let myQueue = new aws.QueueRef("arn:aws:sqs:...."); // <-- ARN of an existing SQS queue
    new cloud.Function(inflight () => {
      myQueue.push("new message");
    });

This works both when running in the simulator and when running on AWS.

The Wing Console also includes some metadata about the queue such as the queue URL and the AWS Console URL:

### Misc

Added an option `link: bool` to `ui.FIeld` to indicate that the value returned is a link. We should make this a clickable link in the Wing Console.
@eladb eladb requested a review from a team as a code owner March 19, 2024 14:42
Copy link

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistence, don't hesitate to ping the relevant owner over Slack.

Topic Owner
Wing SDK and utility APIs @chriscbr
Wing Console @ainvoner, @skyrpex, @polamoros
JSON, structs, primitives and collections @hasanaburayyan
Platforms and plugins @hasanaburayyan
Frontend resources (website, react, etc) @tsuf239
Language design @eladb
VSCode extension and language server @markmcculloh
Compiler architecture, inflights, lifting @yoav-steinberg
Wing Testing Framework @tsuf239
Wing CLI @markmcculloh
Build system, dev environment, releases @markmcculloh
Library Ecosystem @chriscbr
Documentation @hasanaburayyan
SDK test suite @tsuf239
Examples @hasanaburayyan
Wing Playground @eladcon

@monadabot
Copy link
Contributor

monadabot commented Mar 19, 2024

Benchmarks

Comparison to Baseline 🟥⬜🟥🟥⬜⬜⬜⬜🟩⬜🟩🟩🟩
Benchmark Before After Change
version 59ms±0.59 62ms±0.55 +2ms (+4.12%)🟥
empty.test.w -t sim 534ms±31.7 499ms±4.65 -34ms (-6.46%)⬜
empty.test.w -t tf-aws 722ms±4.79 733ms±4 +11ms (+1.56%)🟥
hello_world.test.w -t sim 528ms±3.99 543ms±6.61 +15ms (+2.79%)🟥
hello_world.test.w -t tf-aws 1679ms±9.96 1702ms±11.14 +23ms (+1.36%)⬜
functions_10.test.w -t sim 614ms±10.63 623ms±12.23 +9ms (+1.5%)⬜
functions_10.test.w -t tf-aws 2303ms±13.37 2307ms±16.26 +5ms (+0.2%)⬜
jsii_small.test.w -t sim 507ms±4.23 504ms±3.71 -3ms (-0.64%)⬜
jsii_small.test.w -t tf-aws 738ms±3.89 727ms±4.07 -11ms (-1.43%)🟩
jsii_big.test.w -t sim 2986ms±9.09 2958ms±14.2 -27ms (-0.91%)⬜
jsii_big.test.w -t tf-aws 3198ms±12.55 3145ms±9.39 -52ms (-1.63%)🟩
functions_1.test.w -t sim 538ms±5.2 526ms±4.25 -12ms (-2.29%)🟩
functions_1.test.w -t tf-aws 971ms±5.65 958ms±4.17 -13ms (-1.33%)🟩

⬜ 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 62ms 61ms 63ms 1ms 1ms
empty.test.w -t sim 499ms 483ms 506ms 5ms 7ms
empty.test.w -t tf-aws 733ms 723ms 740ms 4ms 6ms
hello_world.test.w -t sim 543ms 528ms 563ms 7ms 9ms
hello_world.test.w -t tf-aws 1702ms 1688ms 1736ms 11ms 16ms
functions_10.test.w -t sim 623ms 591ms 639ms 12ms 17ms
functions_10.test.w -t tf-aws 2307ms 2274ms 2336ms 16ms 23ms
jsii_small.test.w -t sim 504ms 497ms 512ms 4ms 5ms
jsii_small.test.w -t tf-aws 727ms 719ms 737ms 4ms 6ms
jsii_big.test.w -t sim 2958ms 2925ms 2986ms 14ms 20ms
jsii_big.test.w -t tf-aws 3145ms 3132ms 3171ms 9ms 13ms
functions_1.test.w -t sim 526ms 516ms 535ms 4ms 6ms
functions_1.test.w -t tf-aws 958ms 947ms 966ms 4ms 6ms
Last Updated (UTC) 2024-03-19 18:38

@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 Mar 19, 2024
@monadabot
Copy link
Contributor

monadabot commented Mar 19, 2024

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

Last Updated (UTC) 2024-03-19 18:32

@eladb eladb removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Mar 19, 2024
@MarkMcCulloh
Copy link
Contributor

Is this a one-off solution for the related issue of referencing existing infra or is this intended to be the pattern to follow going forward?

Side note on the benchmark regressions: I'm willing to bet the additional ~90ms added to all the sim compilations are the imports added to libs/wingsdk/src/shared-aws/queue.ts. shared-aws is exported at the root so we'd loading all of these regardless of the target. We've previously avoided this dynamic imports for target-specific stuff, but not sure how easy that'd be here.

@hasanaburayyan
Copy link
Contributor

So firstly this is fucking cool, especially what it does in the console 🔥

Thinking out loud here...

What about organizing these reference classes under a reference namespace so something like this:

let outbox = new aws.reference.Queue("arn...");

@eladb
Copy link
Contributor Author

eladb commented Mar 19, 2024

@MarkMcCulloh asked:

Is this a one-off solution for the related issue of referencing existing infra or is this intended to be the pattern to follow going forward?

This is intended to be the pattern going forward for all external references, so we will have aws.BucketRef, aws.TopicRef, etc...

@eladb
Copy link
Contributor Author

eladb commented Mar 19, 2024

@hasanaburayyan suggested:

What about organizing these reference classes under a reference namespace so something like this: aws.reference.Queue

I am a flat lists and prefixes over namespace hierarchies as it's dramatically improves discoverability.

@eladb
Copy link
Contributor Author

eladb commented Mar 19, 2024

@MarkMcCulloh, what would you recommend to do about the performance regressions (amazing that this was caught)?

Copy link
Contributor

@hasanaburayyan hasanaburayyan left a comment

Choose a reason for hiding this comment

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

LGTM, Im excited about this direction

@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 Mar 19, 2024
@eladb eladb removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Mar 19, 2024
Copy link
Contributor

mergify bot commented Mar 19, 2024

Thanks for contributing, @eladb! This PR will now be added to the merge queue, or immediately merged if eladb/queueref is up-to-date with main and the queue is empty.

@mergify mergify bot merged commit c396ff4 into main Mar 19, 2024
13 checks passed
@mergify mergify bot deleted the eladb/queueref branch March 19, 2024 18:39
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.61.22.

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

Successfully merging this pull request may close these issues.

5 participants