winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.75k stars 186 forks source link

fix(console): runtime errors do not appear in the logs #6625

Closed skyrpex closed 3 weeks ago

skyrpex commented 3 weeks ago

In some instances, runtime errors when invoking cloud.Function won't appear in the logs, or they may appear under Verbose logs.

Related to #6622 but doesn't close it.

github-actions[bot] commented 3 weeks ago

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 assistance, 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 @chriscbr
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 commented 3 weeks ago

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

Last Updated (UTC) 2024-06-04 09:30
skyrpex commented 3 weeks ago

@ainvoner not sure if the snapshots should have those errors, though. Not sure where they come from 🤔

skyrpex commented 3 weeks ago

@MarkMcCulloh can you please review? 🙏🏻

skyrpex commented 3 weeks ago

I restored the consoleLogger.ts so it only logs to the Console UI errors with source=user. There's a problem, though, and it's that when invoking a function from the UI, the error will be logged as source=compiler. Will check if I can fix that.

bring cloud;
// The trace is emitted with source=compiler.
new cloud.Function(inflight (ctx) => {
  throw "oops";
});
monadabot commented 3 weeks ago

Benchmarks

Comparison to Baseline 🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜ | Benchmark | Before | After | Change | | :-- | --: | --: | --: | | version | 57ms±0.6 | 59ms±1.06 | +2ms (+3.66%)🟥 | | functions_10.test.w -t sim | 508ms±18.96 | 494ms±20.75 | -15ms (-2.86%)⬜ | | functions_10.test.w -t tf-aws | 2100ms±20.28 | 2137ms±22.75 | +37ms (+1.78%)⬜ | | hello_world.test.w -t sim | 397ms±5.43 | 407ms±6.82 | +9ms (+2.38%)⬜ | | hello_world.test.w -t tf-aws | 1451ms±5.3 | 1468ms±7.01 | +17ms (+1.19%)⬜ | | functions_1.test.w -t sim | 400ms±3.95 | 409ms±6.94 | +9ms (+2.3%)⬜ | | functions_1.test.w -t tf-aws | 828ms±5.82 | 845ms±8.35 | +17ms (+2.07%)⬜ | | jsii_big.test.w -t sim | 2795ms±8.99 | 2807ms±8.3 | +11ms (+0.41%)⬜ | | jsii_big.test.w -t tf-aws | 3009ms±8.31 | 3018ms±10.72 | +9ms (+0.3%)⬜ | | empty.test.w -t sim | 365ms±3.57 | 365ms±4.24 | +0ms (+0.08%)⬜ | | empty.test.w -t tf-aws | 598ms±5.3 | 599ms±4.59 | +1ms (+0.19%)⬜ | | jsii_small.test.w -t sim | 378ms±3.66 | 375ms±4.5 | -3ms (-0.88%)⬜ | | jsii_small.test.w -t tf-aws | 611ms±6.02 | 608ms±5.77 | -3ms (-0.47%)⬜ | ⬜ 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|59ms|57ms|62ms|1ms|1ms| |functions_10.test.w -t sim|494ms|453ms|550ms|21ms|29ms| |functions_10.test.w -t tf-aws|2137ms|2102ms|2208ms|23ms|32ms| |hello_world.test.w -t sim|407ms|393ms|419ms|7ms|10ms| |hello_world.test.w -t tf-aws|1468ms|1449ms|1480ms|7ms|10ms| |functions_1.test.w -t sim|409ms|397ms|429ms|7ms|10ms| |functions_1.test.w -t tf-aws|845ms|834ms|869ms|8ms|12ms| |jsii_big.test.w -t sim|2807ms|2790ms|2823ms|8ms|12ms| |jsii_big.test.w -t tf-aws|3018ms|2999ms|3051ms|11ms|15ms| |empty.test.w -t sim|365ms|358ms|379ms|4ms|6ms| |empty.test.w -t tf-aws|599ms|589ms|607ms|5ms|6ms| |jsii_small.test.w -t sim|375ms|366ms|388ms|5ms|6ms| |jsii_small.test.w -t tf-aws|608ms|595ms|621ms|6ms|8ms|
Last Updated (UTC) 2024-06-04 09:35
skyrpex commented 3 weeks ago

We may want to revisit our logging system in the Console, since it may have lost its meaning. Anyways, we are now logging runtime errors properly in the Console logs view.

As a side effect, additional error logs appear in the test snapshots (which seems the correct behavior to me).

skyrpex commented 3 weeks ago

Thanks for the feedback, Mark. I'm closing this down to gather my thoughts and also some data because I feel there's something fundamentally wrong with the current logging setup.