wing icon indicating copy to clipboard operation
wing copied to clipboard

chore(sdk): switch function log format from `text` to `JSON` for AWS platforms

Open garysassano opened this issue 1 year ago • 14 comments

A best practice when authoring Lambda functions is to use the Powertools for AWS Lambda Logger, which allows to emit structured logs in JSON format. However, even if you choose not to use Powertools, you can still take advantage of the JSON format to make navigating through your functions' logs much easier. This is true especially for the system logs, over which you have no direct control.

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

garysassano avatar Mar 16 '24 09:03 garysassano

Thanks for opening this pull request! :tada: 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 Discord.

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

github-actions[bot] avatar Mar 16 '24 09:03 github-actions[bot]

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

Last Updated (UTC) 2024-07-04 00:45

monadabot avatar Mar 16 '24 09:03 monadabot

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version ... ... ...
jsii_small.test.w -t sim 394ms±24.88 381ms±6.98 -13ms (-3.26%)⬜
jsii_small.test.w -t tf-aws 617ms±5.84 611ms±7.02 -6ms (-0.98%)⬜
jsii_big.test.w -t sim 2990ms±34.21 2965ms±13.33 -26ms (-0.86%)⬜
jsii_big.test.w -t tf-aws 3184ms±7.83 3183ms±14.51 -1ms (-0.02%)⬜
functions_10.test.w -t sim 501ms±10.17 492ms±18.28 -8ms (-1.68%)⬜
functions_10.test.w -t tf-aws 2114ms±9.84 2099ms±12.94 -15ms (-0.71%)⬜
hello_world.test.w -t sim 409ms±6.48 402ms±4.31 -6ms (-1.58%)⬜
hello_world.test.w -t tf-aws 1467ms±12.05 1465ms±6.96 -2ms (-0.16%)⬜
empty.test.w -t sim 367ms±2.95 365ms±5.98 -1ms (-0.34%)⬜
empty.test.w -t tf-aws 605ms±2.92 599ms±3.91 -6ms (-1%)⬜
functions_1.test.w -t sim 406ms±4.78 405ms±4.27 -1ms (-0.36%)⬜
functions_1.test.w -t tf-aws 843ms±7.11 830ms±7.04 -13ms (-1.6%)⬜

⬜ 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 ... ... ... ... ...
jsii_small.test.w -t sim 381ms 369ms 402ms 7ms 10ms
jsii_small.test.w -t tf-aws 611ms 594ms 628ms 7ms 10ms
jsii_big.test.w -t sim 2965ms 2939ms 3001ms 13ms 19ms
jsii_big.test.w -t tf-aws 3183ms 3158ms 3225ms 15ms 20ms
functions_10.test.w -t sim 492ms 425ms 515ms 18ms 26ms
functions_10.test.w -t tf-aws 2099ms 2079ms 2139ms 13ms 18ms
hello_world.test.w -t sim 402ms 392ms 413ms 4ms 6ms
hello_world.test.w -t tf-aws 1465ms 1451ms 1484ms 7ms 10ms
empty.test.w -t sim 365ms 352ms 383ms 6ms 8ms
empty.test.w -t tf-aws 599ms 592ms 609ms 4ms 5ms
functions_1.test.w -t sim 405ms 398ms 415ms 4ms 6ms
functions_1.test.w -t tf-aws 830ms 817ms 841ms 7ms 10ms
Last Updated (UTC) 2024-07-04 00:51

monadabot avatar Mar 16 '24 09:03 monadabot

@Chriscbr what do you think?

tsuf239 avatar Mar 18 '24 13:03 tsuf239

It sounds handy, let's try it 👍

Chriscbr avatar Mar 18 '24 16:03 Chriscbr

Hi @garysassano, Can you please resolve the conflicts? (you can accept incoming changes, and let the PR actions fix them)

tsuf239 avatar Mar 24 '24 09:03 tsuf239

I started an automated test on aws here

tsuf239 avatar Mar 24 '24 13:03 tsuf239

The automated aws tests are failing: https://github.com/winglang/wing/pull/5955#issuecomment-2016814275 I'm not sure, but it seems like this PR caused it indirectly- and that a fix is needed at our end @MarkMcCulloh what do you think?

tsuf239 avatar Mar 24 '24 14:03 tsuf239

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 discord at winglang.discord.com. Feel free to re-open this PR when it is still relevant and ready to be worked on again. Thanks!

github-actions[bot] avatar Apr 14 '24 06:04 github-actions[bot]

Hi @garysassano, can you please update from main?

tsuf239 avatar Apr 17 '24 12:04 tsuf239

:x: Unstable Self-Mutation :x:

Self-mutation has run twice in a row. There may be a something non-deterministic in the build or test process. Check the last mutation commit (ec85f99b0609a79e12b24080740b450dedfffe3b) for suspicious changes. This is typically caused by:

  • Absolute paths
  • Timestamps
  • Random values
  • Flakey tests (relying on one of the above)

monadabot avatar Apr 18 '24 08:04 monadabot

@garysassano math doesn't seem to work on AWS, can you please check? https://github.com/winglang/wing/actions/runs/8866141232/job/24343706916 (also, it doesn't pass mutation)

tsuf239 avatar Apr 28 '24 08:04 tsuf239

I opened issue #6363, it should be fine once it gets fixed.

garysassano avatar Apr 28 '24 15:04 garysassano

Sdk spec tests are successful on tf-aws! 🤩

it can be merged as soon as you'll fix the pr action

tsuf239 avatar May 15 '24 08:05 tsuf239

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 Discord. Feel free to re-open this PR when it is still relevant and ready to be worked on again. Thanks!

github-actions[bot] avatar Jun 26 '24 06:06 github-actions[bot]

Hi @garysassano do you need any help?

tsuf239 avatar Jul 03 '24 11:07 tsuf239

tests passed again: https://github.com/winglang/wing/actions/runs/9790966100

tsuf239 avatar Jul 04 '24 09:07 tsuf239

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

mergify[bot] avatar Jul 04 '24 09:07 mergify[bot]

Well done @garysassano!!! 🏆 🎉🥳🎉👏👏👏

tsuf239 avatar Jul 04 '24 09:07 tsuf239

Congrats! :rocket: This was released in Wing 0.76.11.

monadabot avatar Jul 04 '24 09:07 monadabot

Well done @garysassano !

revitalbarletz avatar Jul 04 '24 10:07 revitalbarletz