From 323a5db6444b4fbb1cb1e58e80ea1ef03d9e79f8 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Fri, 28 Feb 2025 08:38:33 +0200 Subject: [PATCH] Introduce `url.scheme` tag into `http.server.active.requests` metric --- .../runtime/binder/vertx/VertxHttpServerMetrics.java | 4 +++- .../runtime/binder/vertx/VertxMeterBinderAdapter.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpServerMetrics.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpServerMetrics.java index 8714275850068..81d01bbca82a1 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpServerMetrics.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpServerMetrics.java @@ -22,6 +22,7 @@ import io.quarkus.micrometer.runtime.binder.HttpCommonTags; import io.quarkus.micrometer.runtime.export.exemplars.OpenTelemetryContextUnwrapper; import io.vertx.core.http.HttpMethod; +import io.vertx.core.http.HttpServerOptions; import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.ServerWebSocket; import io.vertx.core.spi.metrics.HttpServerMetrics; @@ -53,13 +54,14 @@ public class VertxHttpServerMetrics extends VertxTcpServerMetrics VertxHttpServerMetrics(MeterRegistry registry, HttpBinderConfiguration config, - OpenTelemetryContextUnwrapper openTelemetryContextUnwrapper) { + OpenTelemetryContextUnwrapper openTelemetryContextUnwrapper, HttpServerOptions httpServerOptions) { super(registry, "http.server", null); this.config = config; this.openTelemetryContextUnwrapper = openTelemetryContextUnwrapper; activeRequests = new LongAdder(); Gauge.builder(config.getHttpServerActiveRequestsName(), activeRequests, LongAdder::doubleValue) + .tag("url.scheme", httpServerOptions.isSsl() ? "https" : "http") .register(registry); httpServerMetricsTagsContributors = resolveHttpServerMetricsTagsContributors(); diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderAdapter.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderAdapter.java index 6b9b7625de565..e33b212c1172b 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderAdapter.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderAdapter.java @@ -79,7 +79,8 @@ public MetricsOptions newOptions() { } if (httpBinderConfiguration.isServerEnabled()) { log.debugf("Create HttpServerMetrics with options %s and address %s", options, localAddress); - return new VertxHttpServerMetrics(Metrics.globalRegistry, httpBinderConfiguration, openTelemetryContextUnwrapper); + return new VertxHttpServerMetrics(Metrics.globalRegistry, httpBinderConfiguration, openTelemetryContextUnwrapper, + options); } return null; }