|
32 | 32 | import io.micrometer.core.instrument.config.MeterFilter; |
33 | 33 | import io.micrometer.prometheus.PrometheusMeterRegistry; |
34 | 34 | import io.micrometer.prometheus.PrometheusRenameFilter; |
| 35 | +import io.vertx.core.DeploymentOptions; |
35 | 36 | import io.vertx.core.Vertx; |
36 | 37 | import io.vertx.core.VertxOptions; |
37 | 38 | import io.vertx.core.http.HttpServerOptions; |
|
49 | 50 |
|
50 | 51 | public class Main { |
51 | 52 |
|
| 53 | + private static final int vertxServiceInstances = 1; |
| 54 | + |
52 | 55 | public static void main(String[] args) { |
53 | 56 | final String vertxConfigPath = System.getProperty(Const.Config.VERTX_CONFIG_PATH_PROP); |
54 | 57 | if (vertxConfigPath != null) { |
@@ -157,17 +160,19 @@ public static void main(String[] args) { |
157 | 160 | ); |
158 | 161 |
|
159 | 162 | JwtService jwtService = new JwtService(config); |
160 | | - |
161 | 163 | coreVerticle = new CoreVerticle(cloudStorage, operatorKeyProvider, attestationService, attestationTokenService, enclaveIdProvider, operatorJWTTokenProvider, jwtService, cloudEncryptionKeyProvider); |
162 | 164 | } catch (Exception e) { |
163 | 165 | System.out.println("failed to initialize core verticle: " + e.getMessage()); |
164 | 166 | System.exit(-1); |
165 | 167 | } |
166 | 168 |
|
| 169 | + createVertxInstancesMetric(); |
| 170 | + createVertxEventLoopsMetric(); |
| 171 | + |
167 | 172 | vertx.deployVerticle(enclaveRotatingVerticle); |
168 | 173 | vertx.deployVerticle(operatorRotatingVerticle); |
169 | 174 | vertx.deployVerticle(cloudEncryptionKeyRotatingVerticle); |
170 | | - vertx.deployVerticle(coreVerticle); |
| 175 | + vertx.deployVerticle(coreVerticle, new DeploymentOptions().setInstances(vertxServiceInstances)); |
171 | 176 | }); |
172 | 177 | } |
173 | 178 |
|
@@ -210,6 +215,19 @@ private static void setupMetrics(MicrometerMetricsOptions metricOptions) { |
210 | 215 | .register(Metrics.globalRegistry); |
211 | 216 | } |
212 | 217 |
|
| 218 | + private static void createVertxInstancesMetric() { |
| 219 | + Gauge.builder("uid2.core.vertx_service_instances", () -> vertxServiceInstances) |
| 220 | + .description("gauge for number of vertx service instances requested") |
| 221 | + .register(Metrics.globalRegistry); |
| 222 | + } |
| 223 | + |
| 224 | + private static void createVertxEventLoopsMetric() { |
| 225 | + Gauge.builder("uid2.core.vertx_event_loop_threads", () -> VertxOptions.DEFAULT_EVENT_LOOP_POOL_SIZE) |
| 226 | + .description("gauge for number of vertx event loop threads") |
| 227 | + .register(Metrics.globalRegistry); |
| 228 | + } |
| 229 | + |
| 230 | + |
213 | 231 | /* |
214 | 232 | private static CommandLine parseArgs(String[] args) { |
215 | 233 | final CLI cli = CLI.create("uid2-core") |
|
0 commit comments