|
69 | 69 | public class Main { |
70 | 70 | private static final Logger LOGGER = LoggerFactory.getLogger(Main.class); |
71 | 71 |
|
| 72 | + // Startup timing field |
72 | 73 | private static volatile Instant startupBeginTime; |
| 74 | + |
73 | 75 | private final JsonObject config; |
74 | 76 | private final Vertx vertx; |
75 | 77 | private final ApplicationVersion appVersion; |
@@ -246,11 +248,25 @@ private KeyManager getKeyManager() { |
246 | 248 | return new KeyManager(this.keysetKeyStore, this.keysetProvider); |
247 | 249 | } |
248 | 250 |
|
| 251 | + /** |
| 252 | + * Calculate startup duration following established codebase patterns. |
| 253 | + * @return Duration from startup begin to completion, or null if timing data is invalid |
| 254 | + */ |
| 255 | + private static Duration getStartupDuration() { |
| 256 | + if (startupBeginTime == null) { |
| 257 | + return null; |
| 258 | + } |
| 259 | + return Duration.between(startupBeginTime, Instant.now()); |
| 260 | + } |
| 261 | + |
249 | 262 | public static void recordStartupComplete() { |
250 | | - if (startupBeginTime == null) return; |
251 | | - final Duration d = Duration.between(startupBeginTime, Instant.now()); |
252 | | - Timer.builder("uid2_operator_startup_duration").register(globalRegistry).record(d); |
253 | | - LOGGER.info("Startup in {} ms", d.toMillis()); |
| 263 | + final Duration d = getStartupDuration(); |
| 264 | + if (d == null) return; |
| 265 | + Timer |
| 266 | + .builder("uid2_operator_startup_duration") |
| 267 | + .register(globalRegistry) |
| 268 | + .record(d); |
| 269 | + LOGGER.info("Operator startup completed in {} seconds", String.format("%.3f", d.toMillis() / 1000.0)); |
254 | 270 | } |
255 | 271 |
|
256 | 272 | public static void main(String[] args) throws Exception { |
|
0 commit comments