-
Notifications
You must be signed in to change notification settings - Fork 25
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
Feature request: Support using with Amazon.Lambda.AspNetCoreServer.Hosting #360
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
@hjgraca Thanks for the reply. I did see that example, but that doesn't solve what I am looking to do. If you look at the example in the README for Amazon.Lambda.AspNetCoreServer.Hosting, you'll see that there is no exposed hander method or LambdaEntryPoint. It does set things up in Startup, but the package abstracts away the handler as it is creating a single Lambda function that handles the ASP .NET web API. Since there is nothing to add the annotation to directly, I'm wondering if there is an alternative method to using Powertools with .NET Lambda using this model? |
We are using Minimal API's to host our REST API's in lambda as well. Because you only support method attribute binding we can't use the power tools with minimal api's at least the automatic request/response logging, tracing etc. What you need is to extract the logic from https://github.com/aws-powertools/powertools-lambda-dotnet/blob/develop/libraries/src/AWS.Lambda.Powertools.Logging/Logger.cs and expose it as a middleware, so that it can be attached to the builder pipeline when the app starts in which case it will be invoked on every request. Any plans to support that in the near future? |
Hi @kumaranbsundar @blytheaw , we want to support as many .NET programming models as we can including ASP.NET minimal apis. |
Use case
The minimal API model using Amazon.Lambda.AspNetCoreServer.Hosting is a great way to migrate an existing ASP .NET API to AWS Lambda. However, if one requires better observability, there are not a lot of great options. It would be great if I could use Powertools for logging and tracing while still using this simple hosting model.
If this is already possible, I was not able to find it in the docs. Please advise!
Solution/User Experience
A way to initialize the tracer, logger, and metrics in the standard startup / dependency injection model of .NET would be ideal, rather than having to annotate the handler method specifically. Since the handler itself is not exposed when using the minimal API hosting model, I can't find a way to initialize the tracer and logger.
Alternative solutions
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: