Skip to content
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] Introduce the concept of Lambda handler request handler chain #180

Closed
humanzz opened this issue Oct 22, 2020 · 3 comments

Comments

@humanzz
Copy link

humanzz commented Oct 22, 2020

This library has 2 base Lambda handlers at

Looking to use more Lambda-related features from AWS and some logging related features in a project I'm working on, that made me think that one uniform way to solve all of them would be for the base handlers to have the concept of a request handler chain where each request handler has before/after methods that are invoked and wrap the defined handler method. This is a pattern that's used extensively in request/response services/clients.

The use cases I've recently come across which are triggering this suggestion

  1. CodeGuru Profiler (https://docs.aws.amazon.com/codeguru/latest/profiler-ug/setting-up-lambda.html): their solution to initialize the profiler and to send profiling information is to provide new base handlers in a new package that extend the base handlers defined here.
  2. Aws Sdk v2 service client metrics to CloudWatch: See the discussion on Using MetricPublisher in AWS Lambda aws-sdk-java-v2#2068 regarding how to batch/aggregate/emit metrics efficiently
  3. Similar problems can be solved with custom business metrics emitted as part of a Lambda request
  4. Similar problems can be solved with using log4j and trying to set additional attributes to MDC (in a project I'm working on we wrap each request with code that sets some properties in MDC and then clear them in the end of the request)
@msailes
Copy link
Collaborator

msailes commented Oct 22, 2020

Hi Ahmed,

I think a lot of the points you've raised are being worked on with the Lambda Powertools project.

Github project - https://github.com/awslabs/aws-lambda-powertools-java
Documentation - https://awslabs.github.io/aws-lambda-powertools-java/

Thanks,

Mark

@humanzz
Copy link
Author

humanzz commented Oct 26, 2020

Hi Mark,

Powertools seems really interesting and I did not know about it. I'll have a look but from an initial scan it seems like it address most if not all of the concerns brought up here.

@humanzz
Copy link
Author

humanzz commented Nov 2, 2020

Thanks a lot Mark. I think this issue is no not needed - at least as I look into Powertools.
I'll go ahead and close it, and if I still think there's merit to it, I'll reopen it or open a new one after having a proper look into Powertools

@humanzz humanzz closed this as completed Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants