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

Provide basic functionality like measuring time/success/failure count for function through @Metrics annotation #24

Open
vigneshtdev opened this issue Jul 16, 2021 · 3 comments

Comments

@vigneshtdev
Copy link

vigneshtdev commented Jul 16, 2021

Is your feature request related to a problem? Please describe.
I would like to know time taken & success/failure ration for a service call from lambda function.

Describe the solution you'd like
Currently Metrics annotation only supports capturing cold start, it would be really if we can get time/success/failure count for the method being executed(similar to DCM/DLM :)).

Describe alternatives you've considered

Currently we are using Guava's stopwatch & manually instrumenting the code.

@pankajagrawal16
Copy link

Hi @vigneshtdev Thanks for opening the issue. Since this belongs to core utility Metrics, I would like to hear thoughts from Python folks as well. Moving this to roadmap for further discussion.

@heitorlessa Thoughts on this? Adding built in support for Metrics annotation/decorator to capture success/failure/duration metrics conditionally like cold start

@pankajagrawal16 pankajagrawal16 transferred this issue from aws-powertools/powertools-lambda-java Jul 19, 2021
@heitorlessa
Copy link
Contributor

I'd love to hear more on why the Lambda function default metrics themselves are not sufficient.

I've typically seen this request in cases where customers have a "fat" Lambda function, in which case you could create your own middleware to handle errors with Powertools that also create a metric as you see fit.

NOTE: Middleware "factory" utility isn't available in Java but Python, so you might need more boilerplate hence perhaps the ask.

Is that the case? If so, I'd like to hear more customer demand on this before we consider it.

@vigneshtdev
Copy link
Author

One reason I can think of is with the default metrics provided by lambda it's difficult to distinguish between failures occurring in static block & failures in handleRequest

https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html

Errors – The number of invocations that result in a function error. Function errors include exceptions thrown by your code and exceptions thrown by the Lambda runtime. The runtime returns errors for issues such as timeouts and configuration errors.

Also in case these annotations can be used on non-handleRequest methods then we can analyse individual service calls easily

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

No branches or pull requests

3 participants