diff --git a/tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/cdi/LongHistogramTest.java b/tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/cdi/LongHistogramTest.java index 8fc13031..760c9992 100644 --- a/tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/cdi/LongHistogramTest.java +++ b/tck/metrics/src/main/java/org/eclipse/microprofile/telemetry/metrics/tck/cdi/LongHistogramTest.java @@ -21,6 +21,8 @@ **********************************************************************/ package org.eclipse.microprofile.telemetry.metrics.tck.cdi; +import java.util.List; + import org.eclipse.microprofile.telemetry.metrics.tck.TestLibraries; import org.eclipse.microprofile.telemetry.metrics.tck.exporter.InMemoryMetricExporter; import org.eclipse.microprofile.telemetry.metrics.tck.exporter.InMemoryMetricExporterProvider; @@ -34,6 +36,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.metrics.LongHistogram; import io.opentelemetry.api.metrics.Meter; import io.opentelemetry.sdk.autoconfigure.spi.metrics.ConfigurableMetricExporterProvider; @@ -47,8 +50,8 @@ public class LongHistogramTest extends Arquillian { private static final String histogramDescription = "Testing long histogram"; private static final String histogramUnit = "Metric Tonnes"; - private static final double DOUBLE_WITH_ATTRIBUTES = 20; - private static final double DOUBLE_WITHOUT_ATTRIBUTES = 10; + private static final long LONG_WITH_ATTRIBUTES = 20; + private static final long LONG_WITHOUT_ATTRIBUTES = 10; @Deployment public static WebArchive createTestArchive() { @@ -86,8 +89,11 @@ void testLongHistogram() throws InterruptedException { .setUnit(histogramUnit) .build(); Assert.assertNotNull(longHistogram); - longHistogram.record(10, Attributes.empty()); - longHistogram.record(10, Attributes.builder().put("K", "V").build()); + longHistogram.record(LONG_WITH_ATTRIBUTES, Attributes.empty()); + longHistogram.record(LONG_WITHOUT_ATTRIBUTES, Attributes.builder().put("K", "V").build()); + + List metrics = metricExporter.getMetricData((MetricDataType.DOUBLE_SUM)); + MetricData metric = metricExporter.getMetricData((MetricDataType.HISTOGRAM)).get(0); Assert.assertEquals(metric.getName(), histogramName); Assert.assertEquals(metric.getDescription(), histogramDescription);