Skip to content

Commit 0623771

Browse files
committed
Revert "update metric using timer"
This reverts commit 60f36d3.
1 parent 60f36d3 commit 0623771

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

src/main/java/com/uid2/operator/Main.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@
6969
public class Main {
7070
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
7171

72+
// Startup timing field
7273
private static volatile Instant startupBeginTime;
74+
7375
private final JsonObject config;
7476
private final Vertx vertx;
7577
private final ApplicationVersion appVersion;
@@ -246,11 +248,25 @@ private KeyManager getKeyManager() {
246248
return new KeyManager(this.keysetKeyStore, this.keysetProvider);
247249
}
248250

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+
249262
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));
254270
}
255271

256272
public static void main(String[] args) throws Exception {

0 commit comments

Comments
 (0)