Description
Use case
As a customer, I want to see a warning log in my Lambda functions that are using the logMetrics
decorator or middleware, if no metric is emitted.
This warning log will help users of the Metrics utility to detect instances in which the utility is present in the code, but not being really used. With this information they can then decide whether they want to remove the utility or fix issues related to metrics not being emitted correctly.
This feature is present in the Powertools for Python version, and was discussed here: aws-powertools/powertools-lambda-python#1926
Solution/User Experience
If no metric is emitted the utility should emit a log that says:
No application metrics to publish. The cold-start metric may be published if enabled. If application metrics should never be empty, consider using "throwOnEmptyMetrics"
Alternative solutions
No response
Acknowledgment
- This feature request meets Lambda Powertools Tenets
- Should this be considered in other Lambda Powertools languages? i.e. Python, Java