diff --git a/archetypes/helidon/src/main/archetype/common/extra.xml b/archetypes/helidon/src/main/archetype/common/extra.xml index 673d593e15a..8101ae756f3 100644 --- a/archetypes/helidon/src/main/archetype/common/extra.xml +++ b/archetypes/helidon/src/main/archetype/common/extra.xml @@ -101,6 +101,11 @@ java -cp "target/classes:target/libs/*" {{package}}.WebClientMain PORT io.helidon.microprofile.metrics helidon-microprofile-metrics + + io.helidon.metrics + helidon-metrics + runtime + io.helidon.microprofile.faulttolerance diff --git a/archetypes/helidon/src/main/archetype/common/observability.xml b/archetypes/helidon/src/main/archetype/common/observability.xml index 495c9196b34..6a596a02edb 100644 --- a/archetypes/helidon/src/main/archetype/common/observability.xml +++ b/archetypes/helidon/src/main/archetype/common/observability.xml @@ -55,15 +55,24 @@ curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics ]]> - - + + + io.helidon.metrics + helidon-metrics + runtime + + org.eclipse.microprofile.metrics microprofile-metrics-api - + io.helidon.microprofile.metrics helidon-microprofile-metrics + + io.helidon.webserver.observe + helidon-webserver-observe-metrics + org.eclipse.microprofile.metrics.MetricUnits @@ -98,9 +107,23 @@ curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics org.eclipse.microprofile.metrics.Counter org.eclipse.microprofile.metrics.MetricRegistry + + io.helidon.metrics.api.MetricsFactory + + + org.junit.jupiter.api.BeforeAll + static org.junit.jupiter.api.Assertions.assertEquals + + + io.helidon.microprofile.metrics - micrometer.core @@ -201,18 +223,29 @@ curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics - - io.helidon.integrations.micrometer - helidon-integrations-micrometer-cdi + + io.helidon.metrics + helidon-metrics-api + runtime + compile + + + io.helidon.metrics + helidon-metrics + runtime - io.helidon.integrations.micrometer - helidon-integrations-micrometer + io.helidon.webserver.observe + helidon-webserver-observe-metrics + + + org.eclipse.microprofile.metrics + microprofile-metrics-api - io.micrometer.core.annotation.Counted - io.micrometer.core.annotation.Timed + org.eclipse.microprofile.metrics.annotation.Counted + org.eclipse.microprofile.metrics.annotation.Timed jakarta.ws.rs.PathParam @@ -227,17 +260,34 @@ curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics @Path("/{name}") @GET @Produces(MediaType.APPLICATION_JSON) - @Counted(value = PERSONALIZED_GETS_COUNTER_NAME, description = PERSONALIZED_GETS_COUNTER_DESCRIPTION) - @Timed(value = GETS_TIMER_NAME, description = GETS_TIMER_DESCRIPTION, histogram = true) + @Counted(name = PERSONALIZED_GETS_COUNTER_NAME, description = PERSONALIZED_GETS_COUNTER_DESCRIPTION, absolute = true) + @Timed(name = GETS_TIMER_NAME, description = GETS_TIMER_DESCRIPTION, absolute = true) public String getMessage(@PathParam("name") String name) { return String.format("Hello %s", name); }]]> - - io.helidon.integrations.micrometer.MicrometerSupport + + org.eclipse.microprofile.metrics.Counter + org.eclipse.microprofile.metrics.MetricRegistry + + + io.helidon.metrics.api.MetricsFactory + + + org.junit.jupiter.api.BeforeAll + + + - - + + - - - - - io.micrometer.core.instrument.Counter - io.micrometer.core.instrument.MeterRegistry - static org.junit.jupiter.api.Assertions.assertEquals @@ -276,17 +317,17 @@ curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics - io.helidon.integrations.micrometer.MicrometerFeature - io.micrometer.core.instrument.Counter - io.micrometer.core.instrument.Timer + io.helidon.metrics.api.Counter + io.helidon.metrics.api.Metrics + io.helidon.metrics.api.MeterRegistry + io.helidon.metrics.api.Timer getTimer.record(resp::next)) + .get((req, resp) -> getTimer.record((Runnable) resp::next)) .get("/{name}", (req, resp) -> { personalizedGetCounter.increment(); @@ -313,24 +355,13 @@ allRequests_total 0.0 static final String ALL_GETS_TIMER_NAME = "allGets"; private final Timer getTimer; - private final Counter personalizedGetCounter; - private final MicrometerFeature micrometerFeature;]]> + private final Counter personalizedGetCounter;]]> - - - + MeterRegistry registry = Metrics.globalRegistry(); + this.personalizedGetCounter = registry.getOrCreate(Counter.builder(PERSONALIZED_GETS_COUNTER_NAME)); + this.getTimer = registry.getOrCreate(Timer.builder(ALL_GETS_TIMER_NAME));]]> org.hamcrest.CoreMatchers.containsString @@ -350,7 +381,7 @@ allRequests_total 0.0 assertThat(response.status().code(), is(200)); response = client.get() - .path("/micrometer") + .path("/observe/metrics") .request(); assertThat(response.status().code(), is(200)); @@ -373,12 +404,10 @@ allRequests_total 0.0 ]]> - + - - io.helidon.integrations.micrometer - micrometer.core + + io.helidon.microprofile.metrics @@ -391,17 +420,6 @@ allRequests_total 0.0 optional="true"> - - - jandex runtime + + io.helidon.metrics + helidon-metrics + runtime + org.junit.jupiter junit-jupiter-api diff --git a/archetypes/helidon/src/main/archetype/se/custom/observability.xml b/archetypes/helidon/src/main/archetype/se/custom/observability.xml index bafc8a69fd5..987c72d9fe7 100644 --- a/archetypes/helidon/src/main/archetype/se/custom/observability.xml +++ b/archetypes/helidon/src/main/archetype/se/custom/observability.xml @@ -44,14 +44,6 @@ .addFeature(observe) - - io.helidon.webserver.observe - helidon-webserver-observe-metrics - - - io.helidon.metrics - helidon-metrics - io.helidon.webserver helidon-webserver-tracing