Skip to content

Add compact format to LoggingMetricPublisher - #7451

Draft
Dricmoy wants to merge 1 commit into
aws:masterfrom
Dricmoy:feature/compact-metric-logging
Draft

Dricmoy wants to merge 1 commit into
aws:masterfrom
Dricmoy:feature/compact-metric-logging

Conversation

@Dricmoy

@Dricmoy Dricmoy commented Oct 16, 2026

Copy link
Copy Markdown

Motivation and Context

Closes #6840. LoggingMetricPublisher currently offers PLAIN and PRETTY, both of which can produce verbose logs when metrics are emitted frequently. A single-line format reduces repeated labels while keeping the collection hierarchy readable.

Modifications

  • Add LoggingMetricPublisher.Format.COMPACT, producing output such as Metrics published: ApiCall{RetryCount=0,ApiCallAttempt{HttpStatusCode=200}}.
  • Document the new public format and cover nested, sibling, and empty collections in unit tests.
  • Add a release note generated with scripts/new-change.

Testing

Environment: macOS arm64, JDK 21, Maven wrapper 3.9.5. These commands targeted :metrics-spi and its required modules:

  • ./mvnw -pl :metrics-spi -am test -Dspotbugs.skip=true -Dcheckstyle.skip=true — passed; 25 metrics-spi tests, including the new cases.
  • ./mvnw -pl :metrics-spi -am validate -Dspotbugs.skip=true — passed with zero Checkstyle violations.
  • ./mvnw -pl :metrics-spi -am package -Dskip.unit.tests=true -Dspotbugs.skip=true — passed; unit tests were run in the separate test command above.

SpotBugs was not verified locally: the initial run failed in the unchanged annotations module before reaching metrics-spi.

Screenshots (if appropriate)

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed (focused reactor tests passed; full repository suite was not run)
  • I have added a changelog entry using scripts/new-change
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

Introduce a single-line format that retains metric collection hierarchy while removing repeated class and field labels from logs. Cover nested and empty collections and document the new option. Resolves aws#6840.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compact logging format for LoggingMetricPublisher

1 participant