Skip to content

Feature request: log a warning when no metric is emitted #1291

Closed
@dreamorosi

Description

@dreamorosi

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

Metadata

Metadata

Assignees

Labels

completedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilitymetricsThis item relates to the Metrics Utility

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions