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, compiler): displaying logs of tf-aws functions #3622

Merged
merged 16 commits into from
Aug 3, 2023

Conversation

tsuf239
Copy link
Contributor

@tsuf239 tsuf239 commented Jul 26, 2023

fixes: #1973

Description

  • Collecting and printing log(...) outputs when running a test on target tf-aws

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.

@tsuf239 tsuf239 requested a review from a team as a code owner July 26, 2023 14:31
libs/wingc/src/jsify.rs Outdated Show resolved Hide resolved
libs/wingc/src/lib.rs Outdated Show resolved Hide resolved
libs/wingsdk/src/shared-aws/function.inflight.ts Outdated Show resolved Hide resolved
libs/wingc/src/lib.rs Outdated Show resolved Hide resolved
libs/wingsdk/src/shared-aws/function.inflight.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/shared-aws/function.inflight.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/shared-aws/function.inflight.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/shared-aws/function.inflight.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/shared-aws/function.inflight.ts Outdated Show resolved Hide resolved
tsuf239 and others added 2 commits July 30, 2023 12:37
Co-authored-by: Chris Rybicki <chrisr@monada.co>
@tsuf239
Copy link
Contributor Author

tsuf239 commented Jul 31, 2023

works on awscdk too:
image

@tsuf239 tsuf239 requested a review from Chriscbr July 31, 2023 13:10
apps/wing/src/cli.ts Outdated Show resolved Hide resolved
tsuf239 and others added 2 commits August 1, 2023 14:06
Signed-off-by: monada-bot[bot] <monabot@monada.co>
@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 Aug 1, 2023
@tsuf239
Copy link
Contributor Author

tsuf239 commented Aug 2, 2023

I found an interesting way to get the logs in O(1) without any async calls, and without wrapping the string,
by introducing a logger class.
This way we can send them to a 3rd party log collector of the user's choice in the future :) and have better control over log levels and formatting.
Therefore, I'll convert this to draft now, and let you know when the new code is ready! 🎉

@tsuf239 tsuf239 marked this pull request as draft August 2, 2023 08:34
@tsuf239
Copy link
Contributor Author

tsuf239 commented Aug 2, 2023

Gave up the logger class idea- chose a much easier approach of changing the console.log behavior in the aws cloud functions to save the wing logs, and display them as traces

@tsuf239 tsuf239 removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Aug 2, 2023
@tsuf239 tsuf239 marked this pull request as ready for review August 2, 2023 13:21
@tsuf239 tsuf239 requested review from eladb and Chriscbr August 2, 2023 13:49
Copy link
Contributor

@Chriscbr Chriscbr left a comment

Choose a reason for hiding this comment

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

Looks good to me - approved conditional on addressing a few small nitpicks. This will be a huge improvement for testing apps on AWS. Once we have more resources on other cloud targets, I imagine we might be able to reuse the approach there as well 🚀

libs/wingsdk/src/target-awscdk/function.ts Show resolved Hide resolved
examples/tests/sdk_tests/function/invoke.w Show resolved Hide resolved
libs/wingsdk/src/std/logger.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/target-awscdk/function.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/target-awscdk/function.ts Outdated Show resolved Hide resolved
@tsuf239
Copy link
Contributor Author

tsuf239 commented Aug 3, 2023

Resolving all comments :) @Chriscbr please let me know if something is missing and I'll push it into a further PR

@mergify
Copy link
Contributor

mergify bot commented Aug 3, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 03d68be into main Aug 3, 2023
11 checks passed
@mergify mergify bot deleted the tsuf/display-logs branch August 3, 2023 10:49
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.24.67.

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.

Logs are not displayed during wing test -t tf-aws
4 participants