Skip to content

Bug: EMF Metrics Logger emits root dict without metrics when no metrics are added #1890

Closed
@phipag

Description

@phipag

Is your feature request related to a problem? Please describe.
When using @FlushMetrics, the default behavior is to log a warning if no metrics emitted. This works correctly. However, when no metrics were added, in addition to logging a warning, the root-level section of the _aws EMF dict is printed. Example:

This is the output when placing @FlushMetrics on a Lambda handler that is not interacting with metrics at all.

{"Service":"payment","logStreamId":"$LATEST","functionVersion":"$LATEST","executionEnvironment":"AWS_Lambda_java11"}

Describe the solution you'd like
If no metrics are added, we should not attempt to flush since this seems to be a bug in the underlying aws-embedded-metrics library.

The expected output is that nothing except for the warning is logged when the user is not emitting any metrics.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Coming soon

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions