From 38449e17323efd8b440d4da0cfd55e5d5b7f9222 Mon Sep 17 00:00:00 2001 From: Sophia Chen Date: Wed, 18 Dec 2024 16:01:20 +1100 Subject: [PATCH] sch-UID2-4560-adding-gauge-for-number-of-request-processing-threads added gauge for event loop threads --- src/main/java/com/uid2/core/Main.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/uid2/core/Main.java b/src/main/java/com/uid2/core/Main.java index 0ecf138..3e6d8ab 100644 --- a/src/main/java/com/uid2/core/Main.java +++ b/src/main/java/com/uid2/core/Main.java @@ -32,6 +32,7 @@ import io.micrometer.core.instrument.config.MeterFilter; import io.micrometer.prometheus.PrometheusMeterRegistry; import io.micrometer.prometheus.PrometheusRenameFilter; +import io.vertx.core.DeploymentOptions; import io.vertx.core.Vertx; import io.vertx.core.VertxOptions; import io.vertx.core.http.HttpServerOptions; @@ -159,17 +160,19 @@ public static void main(String[] args) { ); JwtService jwtService = new JwtService(config); - createServiceInstancesMetric(); coreVerticle = new CoreVerticle(cloudStorage, operatorKeyProvider, attestationService, attestationTokenService, enclaveIdProvider, operatorJWTTokenProvider, jwtService, cloudEncryptionKeyProvider); } catch (Exception e) { System.out.println("failed to initialize core verticle: " + e.getMessage()); System.exit(-1); } + createVertxInstancesMetric(); + createVertxEventLoopsMetric(); + vertx.deployVerticle(enclaveRotatingVerticle); vertx.deployVerticle(operatorRotatingVerticle); vertx.deployVerticle(cloudEncryptionKeyRotatingVerticle); - vertx.deployVerticle(coreVerticle); + vertx.deployVerticle(coreVerticle, new DeploymentOptions().setInstances(vertxServiceInstances)); }); } @@ -212,12 +215,19 @@ private static void setupMetrics(MicrometerMetricsOptions metricOptions) { .register(Metrics.globalRegistry); } - private static void createServiceInstancesMetric() { + private static void createVertxInstancesMetric() { Gauge.builder("uid2.core.vertx_service_instances", () -> vertxServiceInstances) - .description("gauge for number of request processing threads") + .description("gauge for number of vertx service instances requested") .register(Metrics.globalRegistry); } + private static void createVertxEventLoopsMetric() { + Gauge.builder("uid2.core.vertx_event_loop_threads", () -> VertxOptions.DEFAULT_EVENT_LOOP_POOL_SIZE) + .description("gauge for number of vertx event loop threads") + .register(Metrics.globalRegistry); + } + + /* private static CommandLine parseArgs(String[] args) { final CLI cli = CLI.create("uid2-core")