From c68b551dff0bd48901076eecc21f733dd4b3c0f5 Mon Sep 17 00:00:00 2001 From: Michael Commey Date: Thu, 6 Aug 2026 14:15:45 +0000 Subject: [PATCH] Format JVM metrics units for Tomcat --- internal/cloudwatch/unit.go | 7 +++++++ internal/cloudwatch/unit_test.go | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/cloudwatch/unit.go b/internal/cloudwatch/unit.go index 478034e3ec8..ac838b740e3 100644 --- a/internal/cloudwatch/unit.go +++ b/internal/cloudwatch/unit.go @@ -79,6 +79,13 @@ var knownNonConvertibleUnits = collections.NewSet( "errors", "threads", "requests", + // JMX/Tomcat and JVM UCUM annotation units (JMX Metric Gatherer v1.50.0-alpha) + "{session}", + "{error}", + "{thread}", + "{request}", + "{class}", + "{collection}", // JMX/Kafka units "{messages}", "{requests}", diff --git a/internal/cloudwatch/unit_test.go b/internal/cloudwatch/unit_test.go index 8bc1c3ea4ff..a22de43978f 100644 --- a/internal/cloudwatch/unit_test.go +++ b/internal/cloudwatch/unit_test.go @@ -70,7 +70,11 @@ func TestScaledUnits(t *testing.T) { } func TestKnownNonStandardUnits(t *testing.T) { - testCases := []string{"errors", "{requests}"} + testCases := []string{ + "errors", "{requests}", + // UCUM annotation units (Tomcat/JVM) + "{session}", "{error}", "{thread}", "{request}", "{class}", "{collection}", + } for _, testCase := range testCases { unit, scale, err := ToStandardUnit(testCase) assert.NoError(t, err)