Skip to content

Lambda Logs API? #392

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

Closed
tannerntannern opened this issue Jan 7, 2022 · 5 comments · Fixed by #394 or #416
Closed

Lambda Logs API? #392

tannerntannern opened this issue Jan 7, 2022 · 5 comments · Fixed by #394 or #416

Comments

@tannerntannern
Copy link

I've successfully used this project's lambda-extension library to respond to Invoke and Shutdown events (as the examples demonstrate), but I'm struggling to figure out the best path to use the Lambda Logs API.

My understanding of the lambda-extension library code (as a Rust novice) is that the extension_id is private. In order to use the Lambda Logs API you must subscribe with the extension ID, which you get from registering the extension with the Extensions API. But there's no way that I can see to get the extension_id after registering the extension.

So my question is: If I've used the lambda-extension library as the base for my extension, how can I use the Lambda Logs API if the extension ID is unavailable externally? I could imagine a new lambda-logs library or additional functions in the lambda-extension library, but neither of those options exist currently. What can I do in the meantime without essentially reimplementing the lambda-extension library myself?

@calavera
Copy link
Contributor

calavera commented Jan 7, 2022

oh no! 🤦 that's unfortunate because when I started working on the extensions api, I exposed the ID, but we removed it because we didn't remember that the logs API uses it. See this commit.

I think it'd be worth considering a way to add it back, even if it's not backwards compatible.

PS: I'm glad that crate was useful for you 🎊

@tannerntannern
Copy link
Author

Thanks for the quick response. Regarding exposing the ID, I'm wondering if it would be sufficient to simply make the extension_id field public? I like the idea of the library managing the extension registration for me so I can just read the ID afterwards. I'm not well versed in Rust design patterns though, so I'm not sure if that would be an acceptable solution.

@nmoutschen
Copy link
Contributor

In term of backward compatibility, I think we can still add it back since we didn't publish a new crate version yet. As long as something is on the master branch but not yet publishes on crates.io, we should be flexible. Basically, I see the master branch as an unstable version. 😄

I think as a short term, we could expose the extension ID (maybe it could be useful for other things in the future - e.g. even just for logging purposes), but I'm unsure what the best way to expose it would be.

That said, long term, we should definitively have a high-level library to interact with the Logs API. For the latter, happy to draft an RFC once I'm back from the winter break.

@calavera
Copy link
Contributor

calavera commented Jan 8, 2022

This might need some more work: #394 (comment)

@nmoutschen
Copy link
Contributor

I started an RFC issue to track what the experience would look like: #396

I'd appreciate feedback/ideas on it. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants