Skip to content

Feature request: rename raiseOnEmptyMetrics to throwOnEmptyMetrics #348

Closed
@saragerion

Description

@saragerion

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 to throw)
  • 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

Related issues, RFCs

Metadata

Metadata

Assignees

No one assigned

    Labels

    completedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilitygood-first-issueSomething that is suitable for those who want to start contributingmetricsThis item relates to the Metrics Utility

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions