Closed
Description
Description of the feature request
Currently the metrics Class has a class propriety shouldRaiseOnEmptyMetrics
and middleware/decorator parameter raiseOnEmptyMetrics
that when set to true, will cause the library to throw an error when no metrics are created.
As flagged by @dreamorosi in this PR, throw
is a more intuitive and accurate way to describe the behaviour in the Node.js runtime.
The name is currently ported as it is from the Python library.
Problem statement
Based on above, the name of the parameters can be confusing for developers using the Node.js runtime.
Summary of the feature
- Rename both the middleware/decorator parameters, the class propriety and the types (from
raise
tothrow
) - Update the documentations and examples
Code examples
const handlerWithMiddleware = middy(lambdaHandler)
.use(logMetrics(metrics, { throwOnEmptyMetrics: true }));
Benefits for you and the wider AWS community
Better clarity of the feature, less confusion.
Describe alternatives you've considered
N/A
Additional context