Skip to content

fix(metrics): clarify empty application metrics warning - #2758

Open
hidingmyname wants to merge 1 commit into
aws-powertools:mainfrom
hidingmyname:fix/metrics-empty-warning-2731
Open

hidingmyname wants to merge 1 commit into
aws-powertools:mainfrom
hidingmyname:fix/metrics-empty-warning-2731

Conversation

@hidingmyname

@hidingmyname hidingmyname commented Nov 17, 2026 •

Copy link
Copy Markdown

Summary

Clarify that the empty-metrics warning refers to application metrics, not the separately published ColdStart metric.

Changes

  • Clarify that the empty-metrics warning applies to application metrics and that a separately emitted cold-start metric may still be published.
  • Keep the empty check, WARN severity, publication behavior, and raiseOnEmptyMetrics exception type/message unchanged.
  • Replace the shared-log-file wording assertion with behavior coverage: an empty application collection emits no EMF document, and a published ColdStart does not satisfy raiseOnEmptyMetrics.
  • Document the separate cold-start publication and the application-metrics empty check in the existing metrics guide.

Issue number: Fixes #2731

Verification

Local check Observed result
Java 17: mvn -B -pl powertools-metrics -am clean test 183 tests passed: common 44, metrics 139; no failures/errors/skips
Java 25: mvn -B -pl powertools-metrics -am clean verify -Pbuild-with-spotbugs The same 183 tests pass; SpotBugs reports zero bugs in both modules
Java 21: mvn -B clean verify -Pbuild-with-spotbugs Full default reactor: all 61 modules succeeded, including examples and handler packaging
Independent real-logger executable Before: ColdStart: 1.0 EMF plus misleading warning; after: the same EMF plus the application-metrics clarification

The executable also checks an entirely empty flush (warn, no EMF), application metrics (EMF, no warning), and raiseOnEmptyMetrics after cold-start publication (unchanged exception and message). Each case runs in a fresh JVM. The exact warning is verified through actual stdout/stderr rather than a new wording-only unit test.

No build or dependency files changed. No AWS deployment, cloud end-to-end, GraalVM native-image, or full MkDocs site verification was performed.

Contribution context

Issue #2731 is open and untriaged. I checked open and recently closed PRs and found no duplicate implementation. This submission does not imply prior maintainer acceptance.

AI disclosure

Implemented and submitted by the omp AI coding assistant in the omp harness on behalf of @hidingmyname, at their request. The current CONTRIBUTING.md, pull request template, build workflow, and repository guidance were consulted.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

The cold-start metric is published through a separate logger, so the empty check only describes application metrics. Clarify the warning without changing publication or raise-on-empty behavior, document the distinction, and preserve the empty/cold-start exception invariants through the public Metrics interface.
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Clarify the "No metrics were emitted" warning when the ColdStart metric was published

1 participant