Skip to content

Format JVM metrics units for Tomcat - #2235

Open
Paamicky wants to merge 3 commits into
mainfrom
mcommey/tomcat-jvm-metrics-format
Open

Format JVM metrics units for Tomcat#2235
Paamicky wants to merge 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 (5efb6c4) vs v1.300070.0
amazon-cloudwatch-agent 193.3 MB +0 B ${\color{green}▼}$ 38.0 MB (-16.4%)
amazon-cloudwatch-agent-config-wizard 2.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+4.5%)
config-downloader 2.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+4.5%)
config-translator 2.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+4.5%)
start-amazon-cloudwatch-agent 2.5 MB +0 B ${\color{red}▲}$ +81.9 KB (+3.4%)
workload-discovery 3.0 MB +0 B ${\color{red}▲}$ +94.2 KB (+3.2%)
Total 204.8 MB +0 B ${\color{green}▼}$ 37.6 MB (-15.5%)
linux/amd64 amazon-cloudwatch-agent (last 9 main commits + this PR)

 193 ┤                                        
     ┤                            ███ ███ ███ 
     ┤                            ███ ███ ███ 
     ┤                            ███ ███ ███ 
     ┤                            ███ ███ ███ 
     ┤                            ███ ███ ███ 
     ┤                            ███ ███ ███ 
     ┤                            ███ ███ ███ 
 193 ┤▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ███ ███ ███ 
 MB  └────────────────────────────────────────
      43f2526                             PR
linux/arm64
Binary PR vs main (5efb6c4) vs v1.300070.0
amazon-cloudwatch-agent 177.1 MB +0 B ${\color{green}▼}$ 34.4 MB (-16.3%)
amazon-cloudwatch-agent-config-wizard 2.0 MB +0 B ${\color{green}▼}$ 22 B (-0.0%)
config-downloader 2.0 MB +0 B ${\color{green}▼}$ 22 B (-0.0%)
config-translator 2.0 MB +0 B ${\color{green}▼}$ 22 B (-0.0%)
start-amazon-cloudwatch-agent 2.4 MB +0 B ${\color{red}▲}$ +65.5 KB (+2.8%)
workload-discovery 2.9 MB +0 B ${\color{red}▲}$ +65.5 KB (+2.3%)
Total 188.4 MB +0 B ${\color{green}▼}$ 34.3 MB (-15.4%)
windows/amd64
Binary PR vs main (5efb6c4) vs v1.300070.0
amazon-cloudwatch-agent.exe 196.1 MB ${\color{red}▲}$ +6.1 KB (+0.0%) ${\color{green}▼}$ 38.1 MB (-16.3%)
amazon-cloudwatch-agent-config-wizard.exe 2.1 MB +0 B ${\color{red}▲}$ +130.6 KB (+6.5%)
config-downloader.exe 2.1 MB +0 B ${\color{red}▲}$ +130.0 KB (+6.5%)
config-translator.exe 2.1 MB +0 B ${\color{red}▲}$ +130.6 KB (+6.5%)
start-amazon-cloudwatch-agent.exe 2.3 MB +0 B ${\color{red}▲}$ +112.1 KB (+5.2%)
workload-discovery.exe 2.9 MB +0 B ${\color{red}▲}$ +97.3 KB (+3.5%)
Total 207.7 MB ${\color{red}▲}$ +6.1 KB (+0.0%) ${\color{green}▼}$ 37.5 MB (-15.3%)
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>

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.

1 participant