Skip to content

Commit

Permalink
sch-UID2-4560-adding-gauge-for-number-of-request-processing-threads a…
Browse files Browse the repository at this point in the history
…dded gauge for event loop threads
  • Loading branch information
sophia-chen-ttd committed Dec 18, 2024
1 parent 9aca44d commit 38449e1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/main/java/com/uid2/core/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
});
}

Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 38449e1

Please sign in to comment.