middyjs / middy

🛵 The stylish Node.js middleware engine for AWS Lambda 🛵
https://middy.js.org
MIT License
3.73k stars 377 forks source link

Version 6 #1125

Open willfarrell opened 1 year ago

willfarrell commented 1 year ago

aka The OTel Update (Hopefully)

Release: Nov (after nodejs active LTS starts)

Timeline based on AWS nodejs22.x release cycle

Release Notes: https://github.com/middyjs/middy/blob/release/6.0.0/website/docs/upgrade/5-6.md

Planned

Moved to v17

Maybe

dreamorosi commented 4 months ago

Hi @willfarrell - would like to learn more about the OTel/Powertools points in the list above.

On our side we’ve been looking at OTel closely and for now we have decided to not move forward because the performance impact, especially on cold starts, is still too big.

At least for now, that’s something we won’t be doing at least until 2025, which would be v7 for you.

Curious to hear if you’ve arrived at different conclusions

willfarrell commented 4 months ago

@dreamorosi

On our side we’ve been looking at OTel closely and for now we have decided to not move forward because the performance impact, especially on cold starts, is still too big.

Same, along with OTel Logging not supported for nodejs yet (at least the last time i checked).

OTel was listed for v5, but sounds like it's still not ready for production yet. The idea is to deprecate our logging/cloudwatch middlewares for Powertools using OTel, whenever it's ready. The switch to Otel is the only big change on the horizon for Middy currently.

jlarmstrongiv commented 4 months ago

Might be worthwhile improving middleware types https://github.com/middyjs/middy/issues/1221#issuecomment-2210497881

dmeehan1968 commented 3 months ago

middy currently throws exceptions dependent on whether the event/onError handler returns a response that is 'undefined'. However, void/undefined is a legitimate value for many Lambdas (indeed the default handler definition is for a return value of void | Promise<any>.

Whilst the invocation source of the Lambda should discard any received response the docs currently state 'return request.response will silence the error', but this is only the case if some other middleware had set a response value. At the origin handlers point of failure, response would be undefined.

In my case (EventBridge Rule target), I wanted to send some errors immediately to a DLQ, as Lambda retry wouldn't have been meaningful. I found that return request.response ?? null was what I needed to prevent the error from bubbling up.

joebowbeer commented 3 months ago

Why wait for OTEL logging? OTEL is not all or nothing; the three parts are separable.

Being able to leverage OTEL metrics and/or traces would be helpful.

For example, prometheus can now receive OTLP metrics directly. See exporter-metrics-otlp-http.

The modular OTEL producer/reader/exporter design is very flexible.

willfarrell commented 1 month ago

6.0.0-alpha.0 is now released. You can preview the release notes at https://github.com/middyjs/middy/blob/release/6.0.0/website/docs/upgrade/5-6.md