instances) {
+ endOfServiceDiscovery = System.nanoTime();
+ serviceDiscoveryDone = true;
+ if (instances != null) {
+ instanceCounter.increment();
+ }
+ serviceDiscoveryTimer.record(getServiceDiscoveryDuration().getNano(), TimeUnit.NANOSECONDS);
+
+ }
+
+ @Override
+ public int getDiscoveredInstancesCount() {
+ return (int) instanceCounter.count();
+ }
+
+ @Override
+ public void onServiceDiscoveryFailure(Throwable throwable) {
+ endOfServiceDiscovery = System.nanoTime();
+ serviceDiscoveryDone = true;
+ failure = throwable;
+ serviceDiscoveryExceptions.add(throwable);
+ handler.complete(this);
+ serviceDiscoveryTimer.record(getServiceDiscoveryDuration().getNano(), TimeUnit.NANOSECONDS);
+ overallTimer.record(getServiceDiscoveryDuration().getNano(), TimeUnit.NANOSECONDS);
+
+ }
+
+ @Override
+ public void onServiceSelectionSuccess(long id) {
+ endOfServiceSelection = System.nanoTime();
+ selectedInstanceId = id;
+ done = true;
+ handler.complete(this);
+ serviceSelectionTimer.record(getServiceSelectionDuration().getNano(), TimeUnit.NANOSECONDS);
+ overallTimer.record(getOverallDuration().getNano(), TimeUnit.NANOSECONDS);
+
+ }
+
+ @Override
+ public void onServiceSelectionFailure(Throwable throwable) {
+ endOfServiceSelection = System.nanoTime();
+ if (failure != throwable) { //if SD fails we don't know count the error as a LB error
+ failure = throwable;
+ serviceSelectionExceptions.add(throwable);
+ }
+ handler.complete(this);
+ serviceSelectionTimer.record(getServiceSelectionDuration().getNano(), TimeUnit.NANOSECONDS);
+ overallTimer.record(getServiceSelectionDuration().getNano(), TimeUnit.NANOSECONDS);
+ }
+
+ };
+ return STORK_METRICS;
+ }
+
+}
diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java
index 75042e33cf11d..7286227a22b23 100644
--- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java
+++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java
@@ -99,6 +99,7 @@ public static class BinderConfig {
public KafkaConfigGroup kafka;
public RedisConfigGroup redis;
+ public StorkConfigGroup stork;
public GrpcServerConfigGroup grpcServer;
diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/StorkConfigGroup.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/StorkConfigGroup.java
new file mode 100644
index 0000000000000..cca42c194fbb2
--- /dev/null
+++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/StorkConfigGroup.java
@@ -0,0 +1,33 @@
+package io.quarkus.micrometer.runtime.config;
+
+import java.util.Optional;
+
+import io.quarkus.runtime.annotations.ConfigGroup;
+import io.quarkus.runtime.annotations.ConfigItem;
+
+@ConfigGroup
+public class StorkConfigGroup implements MicrometerConfig.CapabilityEnabled {
+ /**
+ * Stork metrics support.
+ *
+ * Support for Stork metrics will be enabled if Micrometer support is enabled,
+ * the Quarkus Stork extension is on the classpath
+ * and either this value is true, or this value is unset and
+ * {@code quarkus.micrometer.binder-enabled-default} is true.
+ */
+ @ConfigItem
+ public Optional enabled;
+
+ @Override
+ public Optional getEnabled() {
+ return enabled;
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName()
+ + "{enabled=" + enabled
+ + '}';
+ }
+
+}
diff --git a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/QuarkusStorkObservableInfrastructure.java b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/QuarkusStorkObservableInfrastructure.java
new file mode 100644
index 0000000000000..1030fab1b6696
--- /dev/null
+++ b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/QuarkusStorkObservableInfrastructure.java
@@ -0,0 +1,22 @@
+package io.quarkus.stork;
+
+import jakarta.inject.Singleton;
+
+import io.smallrye.stork.api.observability.ObservationCollector;
+import io.vertx.core.Vertx;
+
+@Singleton
+public class QuarkusStorkObservableInfrastructure extends QuarkusStorkInfrastructure {
+
+ private final ObservationCollector observationCollector;
+
+ public QuarkusStorkObservableInfrastructure(Vertx vertx, ObservationCollector observationCollector) {
+ super(vertx);
+ this.observationCollector = observationCollector;
+ }
+
+ @Override
+ public ObservationCollector getObservationCollector() {
+ return observationCollector;
+ }
+}
diff --git a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/SmallRyeStorkRecorder.java b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/SmallRyeStorkRecorder.java
index dd82473fdac6c..4935a63c2cf29 100644
--- a/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/SmallRyeStorkRecorder.java
+++ b/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/SmallRyeStorkRecorder.java
@@ -2,11 +2,15 @@
import java.util.List;
+import jakarta.enterprise.inject.Instance;
+import jakarta.enterprise.inject.spi.CDI;
+
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.ShutdownContext;
import io.quarkus.runtime.annotations.Recorder;
import io.smallrye.stork.Stork;
import io.smallrye.stork.api.config.ServiceConfig;
+import io.smallrye.stork.api.observability.ObservationCollector;
import io.vertx.core.Vertx;
@Recorder
@@ -15,7 +19,14 @@ public class SmallRyeStorkRecorder {
public void initialize(ShutdownContext shutdown, RuntimeValue vertx, StorkConfiguration configuration) {
List serviceConfigs = StorkConfigUtil.toStorkServiceConfig(configuration);
StorkConfigProvider.init(serviceConfigs);
- Stork.initialize(new QuarkusStorkInfrastructure(vertx.getValue()));
+ Instance instance = CDI.current().select(ObservationCollector.class);
+ if (instance.isResolvable()) {
+ Stork.initialize(new QuarkusStorkObservableInfrastructure(vertx.getValue(), instance.get()));
+ } else {
+ QuarkusStorkInfrastructure infrastructure = new QuarkusStorkInfrastructure(vertx.getValue());
+ Stork.initialize(infrastructure);
+ }
+
shutdown.addShutdownTask(new Runnable() {
@Override
public void run() {
diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml
index 72498b8752c9e..3fbf2fee70c8a 100644
--- a/independent-projects/resteasy-reactive/pom.xml
+++ b/independent-projects/resteasy-reactive/pom.xml
@@ -67,7 +67,7 @@
5.3.0
1.0.0.Final
2.15.2
- 2.3.1
+ 2.4.0-SNAPSHOT
3.0.2
3.0.3
3.0.0
diff --git a/integration-tests/rest-client-reactive-stork/pom.xml b/integration-tests/rest-client-reactive-stork/pom.xml
index 90f50aadf71f5..4a2387d3b9641 100644
--- a/integration-tests/rest-client-reactive-stork/pom.xml
+++ b/integration-tests/rest-client-reactive-stork/pom.xml
@@ -65,6 +65,10 @@
rest-assured
test