diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/HttpClientMetricsTagsContributor.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/HttpClientMetricsTagsContributor.java index 54fc08a5ffe1b..c6c01ba80f54f 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/HttpClientMetricsTagsContributor.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/HttpClientMetricsTagsContributor.java @@ -3,6 +3,7 @@ import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.config.MeterFilter; import io.vertx.core.spi.observability.HttpRequest; +import io.vertx.core.spi.observability.HttpResponse; /** * Allows code to add additional Micrometer {@link Tags} to the metrics collected for completed HTTP client requests. @@ -20,5 +21,7 @@ public interface HttpClientMetricsTagsContributor { interface Context { HttpRequest request(); + + HttpResponse response(); } } diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpClientMetrics.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpClientMetrics.java index 34cc38ef6878b..159d3598f1c6d 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpClientMetrics.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpClientMetrics.java @@ -172,7 +172,7 @@ public void responseEnd(RequestTracker tracker, long bytesRead) { .and(HttpCommonTags.status(tracker.response.statusCode())) .and(HttpCommonTags.outcome(tracker.response.statusCode())); if (!httpClientMetricsTagsContributors.isEmpty()) { - HttpClientMetricsTagsContributor.Context context = new DefaultContext(tracker.request); + HttpClientMetricsTagsContributor.Context context = new DefaultContext(tracker.request, tracker.response); for (int i = 0; i < httpClientMetricsTagsContributors.size(); i++) { try { Tags additionalTags = httpClientMetricsTagsContributors.get(i).contribute(context); @@ -254,6 +254,7 @@ public String getNormalizedUriPath(Map serverMatchPatterns, Lis } } - private record DefaultContext(HttpRequest request) implements HttpClientMetricsTagsContributor.Context { + private record DefaultContext(HttpRequest request, + HttpResponse response) implements HttpClientMetricsTagsContributor.Context { } }