-
Notifications
You must be signed in to change notification settings - Fork 41
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
[WIP] TracedIOLambda #240
base: main
Are you sure you want to change the base?
[WIP] TracedIOLambda #240
Conversation
Thank you very much for opening this!
I haven't looked in detail at the code yet, but I guess implementing this semantic is what required such extensive changes? It seems tricky to me :) I'm a little curious what the motivation is. Also it seems like this would prevent the Lambda from being able to initialize pro-actively prior to receiving its first request, but maybe this does not matter? |
The motivation is quite simple: make it possible to use
As I described in #233, with existing tracing capabilities in feral this just doesn't work. All spans produced by skunk |
Right, thanks. The part that I'm less sure about is why the traces during the initialization should belong specifically to the span of the initial request, instead of a root "initialization" span for the Lambda itself. IIUC, it would mean that the Lambda is unable to initialize until the first request arrives, which may not be desirable. |
@armanbilge you are right. When using provisioned concurrency, lambda could get initialized before first request. So I overdid this a little bit 😸 I'll try to change this to have "init" span for initialization. Thanks for prompt response! |
No problem, this is tricky stuff and I appreciate your work here! 🚀 |
This solves #233, I think 🙂
As I found out,
IOSetup.setup
needs to get context of the first request to be able to constructTrace[IO]
resource. And then, all custom resources are memoized separately so that any trace spans produced during init are part of main request span. This should be evident fromTracedIOLambdaSuite
.This turned out to be quite a lot of code 😓 I am sure this is not the best implementation possible because my FP skills were at the limit 😄 It would probably be nicer if
IOLambda
andTracedIOLambda
shared more code. Also, there should beTracedIOLambda.Simple
to matchIOLambda.Simple
.Leaving as work-in-progress and waiting for feedback.