Skip to content

Format JVM metrics units for Tomcat - #2235

Merged
Paamicky merged 3 commits into
mainfrom
mcommey/tomcat-jvm-metrics-format
Aug 19, 2026
Merged

Paamicky merged 3 commits into
mainfrom
mcommey/tomcat-jvm-metrics-format

Conversation

@Paamicky

@Paamicky Paamicky commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description of the issue

Since CWA v1.300061.0, the bundled JMX Metric Gatherer JAR switched Tomcat/JVM metric units to UCUM annotation format ({session}, {thread}, {class}, {collection}, {request}, {error}). The agent's knownNonConvertibleUnits set only contains old-format strings, causing non-convertible unit warning logs every collection interval. No data loss occurs (metrics still publish with unit None), but the log noise degrades readability for customers running Tomcat/JVM monitoring.

Issue: https://issues.amazon.com/issues/CWQS-3574

Description of changes

  • Added the six UCUM annotation units ({session}, {error}, {thread}, {request}, {class}, {collection}) to the knownNonConvertibleUnits set in internal/cloudwatch/unit.go. This suppresses the spurious warning logs without changing metric publishing behavior.

License

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

Tests

  • Added unit test cases for all six new UCUM annotation units in TestKnownNonStandardUnits
  • Verified ToStandardUnit returns no error and maps them to None with scale 0

Requirements

  1. Run make fmt and make fmt-sh
  2. Run make lint

Integration Tests

To run integration tests against this PR, add the ready for testing label.

@Paamicky Paamicky added the ready for testing Indicates this PR is ready for integration tests to run label Aug 6, 2026
@Paamicky
Paamicky marked this pull request as ready for review August 6, 2026 14:23
@Paamicky
Paamicky requested a review from a team as a code owner August 6, 2026 14:23
@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Binary Size Report

linux/amd64

Binary PR vs main (486f0c6) vs v1.300072.0
amazon-cloudwatch-agent 194.7 MB ${\color{red}▲}$ +1.4 MB (+0.7%) ${\color{red}▲}$ +1.4 MB (+0.7%)
amazon-cloudwatch-agent-config-wizard 2.0 MB +0 B +0 B
config-downloader 2.0 MB +0 B +0 B
config-translator 2.0 MB +0 B +0 B
start-amazon-cloudwatch-agent 2.5 MB +0 B +0 B
workload-discovery 3.0 MB +0 B +0 B
Total 206.3 MB ${\color{red}▲}$ +1.4 MB (+0.7%) ${\color{red}▲}$ +1.4 MB (+0.7%)
linux/amd64 amazon-cloudwatch-agent (last 9 main commits + this PR)

 195 ┤                                        
     ┤                                    ███ 
     ┤                                    ███ 
     ┤                                    ███ 
     ┤                                    ███ 
     ┤                                    ███ 
     ┤                                    ███ 
     ┤                                    ███ 
 193 ┤▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ███ 
 MB  └────────────────────────────────────────
      2167834                 v1.300072.0 PR

Notable changes:

  • +1.4 MB at PR
linux/arm64
Binary PR vs main (486f0c6) vs v1.300072.0
amazon-cloudwatch-agent 178.5 MB ${\color{red}▲}$ +1.4 MB (+0.8%) ${\color{red}▲}$ +1.4 MB (+0.8%)
amazon-cloudwatch-agent-config-wizard 2.0 MB +0 B +0 B
config-downloader 2.0 MB +0 B +0 B
config-translator 2.0 MB +0 B +0 B
start-amazon-cloudwatch-agent 2.4 MB +0 B +0 B
workload-discovery 2.9 MB +0 B +0 B
Total 189.8 MB ${\color{red}▲}$ +1.4 MB (+0.8%) ${\color{red}▲}$ +1.4 MB (+0.8%)
windows/amd64
Binary PR vs main (486f0c6) vs v1.300072.0
amazon-cloudwatch-agent.exe 196.1 MB ${\color{red}▲}$ +6.1 KB (+0.0%) ${\color{red}▲}$ +6.1 KB (+0.0%)
amazon-cloudwatch-agent-config-wizard.exe 2.1 MB +0 B +0 B
config-downloader.exe 2.1 MB +0 B +0 B
config-translator.exe 2.1 MB +0 B +0 B
start-amazon-cloudwatch-agent.exe 2.3 MB +0 B +0 B
workload-discovery.exe 2.9 MB +0 B +0 B
Total 207.7 MB ${\color{red}▲}$ +6.1 KB (+0.0%) ${\color{red}▲}$ +6.1 KB (+0.0%)
Investigating size changes

Use go-size-analyzer to compare binaries:

GOEXPERIMENT=jsonv2 go install github.com/Zxilly/go-size-analyzer/cmd/gsa@latest
gsa diff --old <baseline-binary> --new <new-binary>

@Paamicky
Paamicky requested review from musa-asad and zhihonl August 13, 2026 15:43
@Paamicky
Paamicky force-pushed the mcommey/tomcat-jvm-metrics-format branch from bbaff96 to ac29ba8 Compare August 17, 2026 15:51
@Paamicky
Paamicky merged commit 87efdff into main Aug 19, 2026
453 of 463 checks passed
@Paamicky
Paamicky deleted the mcommey/tomcat-jvm-metrics-format branch August 19, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for testing Indicates this PR is ready for integration tests to run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants