From 9eb9e9227972dfade01a86fcfe60caee639df4d5 Mon Sep 17 00:00:00 2001 From: Tim Quinn Date: Thu, 31 Aug 2023 10:59:23 -0500 Subject: [PATCH] Rebase --- .../metrics/MicrostreamMetricsSupport.java | 4 ++-- .../neo4j/metrics/src/main/java/module-info.java | 2 -- .../integrations/oci/metrics/OciMetricsData.java | 2 +- .../src/main/java/io/helidon/metrics/api/Meter.java | 1 + metrics/metrics/pom.xml | 13 +++++++++++-- metrics/metrics/src/main/java/module-info.java | 1 - .../microprofile/metrics/MetricsCdiExtension.java | 2 +- .../io/helidon/microprofile/metrics/Registry.java | 4 ++-- microprofile/metrics/src/main/java/module-info.java | 5 ++--- 9 files changed, 20 insertions(+), 14 deletions(-) diff --git a/integrations/microstream/metrics/src/main/java/io/helidon/integrations/microstream/metrics/MicrostreamMetricsSupport.java b/integrations/microstream/metrics/src/main/java/io/helidon/integrations/microstream/metrics/MicrostreamMetricsSupport.java index 762bf9ef427..8579c4ea6f7 100644 --- a/integrations/microstream/metrics/src/main/java/io/helidon/integrations/microstream/metrics/MicrostreamMetricsSupport.java +++ b/integrations/microstream/metrics/src/main/java/io/helidon/integrations/microstream/metrics/MicrostreamMetricsSupport.java @@ -103,8 +103,8 @@ private record GaugeInfo(String name, ToDoubleFunction fn, Tag... tags) { - Gauge.Builder builder(T stateObject) { - Gauge.Builder builder = Gauge.builder(name, stateObject, fn) + Gauge.Builder builder(T stateObject) { + Gauge.Builder builder = Gauge.builder(name, stateObject, fn) .description(description); if (unit != null) { builder.baseUnit(unit); diff --git a/integrations/neo4j/metrics/src/main/java/module-info.java b/integrations/neo4j/metrics/src/main/java/module-info.java index e4d2437180b..0f6a095ba85 100644 --- a/integrations/neo4j/metrics/src/main/java/module-info.java +++ b/integrations/neo4j/metrics/src/main/java/module-info.java @@ -33,8 +33,6 @@ requires io.helidon.integrations.neo4j; requires io.helidon.metrics.api; - requires org.neo4j.driver; - requires transitive io.helidon.common; requires transitive org.neo4j.driver; diff --git a/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsData.java b/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsData.java index 785a0c118d1..0a71333ad70 100644 --- a/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsData.java +++ b/integrations/oci/metrics/metrics/src/main/java/io/helidon/integrations/oci/metrics/OciMetricsData.java @@ -91,7 +91,7 @@ private Stream forCounter(Meter.Id metricId, Counter counter) } private Stream forGauge(Meter.Id metricId, Gauge gauge) { - return Stream.of(metricDataDetails(gauge, metricId, null, gauge.value())); + return Stream.of(metricDataDetails(gauge, metricId, null, gauge.value().doubleValue())); } private Stream forTimer(Meter.Id metricId, Timer timer) { diff --git a/metrics/api/src/main/java/io/helidon/metrics/api/Meter.java b/metrics/api/src/main/java/io/helidon/metrics/api/Meter.java index 79059e3b85d..39aca02b258 100644 --- a/metrics/api/src/main/java/io/helidon/metrics/api/Meter.java +++ b/metrics/api/src/main/java/io/helidon/metrics/api/Meter.java @@ -111,6 +111,7 @@ interface Builder, M extends Meter> { * * @return properly-typed builder itself */ + @SuppressWarnings("unchecked") default B identity() { return (B) this; } diff --git a/metrics/metrics/pom.xml b/metrics/metrics/pom.xml index 48ee08ca4e0..9bd4fe8ef90 100644 --- a/metrics/metrics/pom.xml +++ b/metrics/metrics/pom.xml @@ -40,7 +40,15 @@ - + + io.helidon.common.features + helidon-common-features-api + + + io.helidon.metrics + helidon-metrics-api + + io.helidon.metrics.providers helidon-metrics-providers-micrometer runtime @@ -50,7 +58,8 @@ helidon-metrics-system-meters runtime - + + diff --git a/metrics/metrics/src/main/java/module-info.java b/metrics/metrics/src/main/java/module-info.java index 898cc3878fb..950fd6fc7f3 100644 --- a/metrics/metrics/src/main/java/module-info.java +++ b/metrics/metrics/src/main/java/module-info.java @@ -25,7 +25,6 @@ in = HelidonFlavor.SE, path = {"Metrics"} ) -@SuppressWarnings({ "requires-automatic", "requires-transitive-automatic" }) module io.helidon.metrics { requires static io.helidon.common.features.api; diff --git a/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/MetricsCdiExtension.java b/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/MetricsCdiExtension.java index c9b20df02b8..d6508277c94 100644 --- a/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/MetricsCdiExtension.java +++ b/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/MetricsCdiExtension.java @@ -208,7 +208,7 @@ private static MetricsFeature createMetricsService(Config helidonConfig) { MetricsFeature.Builder builder = MetricsFeature.builder() .meterRegistry(metricsFactory.globalRegistry()) - .metricsConfig(metricsFactory.metricsConfig()) + .metricsConfig(MetricsConfig.builder(metricsFactory.metricsConfig())) .webContext("/metrics") .config(helidonConfig); diff --git a/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/Registry.java b/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/Registry.java index 734fefd8b4a..1cb11e675a8 100644 --- a/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/Registry.java +++ b/microprofile/metrics/src/main/java/io/helidon/microprofile/metrics/Registry.java @@ -624,8 +624,8 @@ private HelidonGauge createGauge(io.helidon.metrics.api.Ga private HelidonGauge createFunctionalCounter(io.helidon.metrics.api.FunctionalCounter.Builder fcBuilder) { io.helidon.metrics.api.Gauge delegate = meterRegistry .getOrCreate(io.helidon.metrics.api.Gauge.builder(fcBuilder.name(), - () -> (long) fcBuilder.fn() - .applyAsDouble(fcBuilder.stateObject()))); + () -> fcBuilder.fn() + .apply(fcBuilder.stateObject()))); return (HelidonGauge) metricsByDelegate.get(delegate); } diff --git a/microprofile/metrics/src/main/java/module-info.java b/microprofile/metrics/src/main/java/module-info.java index e303df714fa..f8453b9745f 100644 --- a/microprofile/metrics/src/main/java/module-info.java +++ b/microprofile/metrics/src/main/java/module-info.java @@ -29,7 +29,6 @@ ) @SuppressWarnings({ "requires-automatic", "requires-transitive-automatic" }) module io.helidon.microprofile.metrics { - requires static io.helidon.common.features.api; requires io.helidon.config.mp; requires io.helidon.metrics.api; @@ -54,8 +53,8 @@ opens io.helidon.microprofile.metrics.spi to io.helidon.microprofile.cdi, weld.core.impl; provides jakarta.enterprise.inject.spi.Extension with io.helidon.microprofile.metrics.MetricsCdiExtension; - provides io.helidon.metrics.spi.MetricsProgrammaticSettings - with io.helidon.microprofile.metrics.MpMetricsProgrammaticSettings; + provides io.helidon.metrics.spi.MetricsProgrammaticConfig + with io.helidon.microprofile.metrics.MpMetricsProgrammaticConfig; provides io.helidon.metrics.spi.MeterRegistryLifeCycleListener with io.helidon.microprofile.metrics.RegistryFactoryManager; provides io.helidon.metrics.spi.InitialMetersConsumer