about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-10 10:31:55 +0200
committerAlan Pearce2024-04-10 10:31:55 +0200
commit8de5eac6f52beba26d3ce6b5406dcf4ac35da641 (patch)
tree2fb1a347fa6203078776622fb58290b22b65e6db
parent458893bd57da4164900e568af801481d68fbb13f (diff)
downloadwebsite-8de5eac6f52beba26d3ce6b5406dcf4ac35da641.tar.lz
website-8de5eac6f52beba26d3ce6b5406dcf4ac35da641.tar.zst
website-8de5eac6f52beba26d3ce6b5406dcf4ac35da641.zip
Add startup performance metric
-rw-r--r--src/index.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/index.ts b/src/index.ts
index 0591e6d..30a6f34 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,3 +1,7 @@
+import { performance } from "node:perf_hooks";
+
+performance.mark("startup-begin");
+
 import log from "loglevel";
 
 import { server, metricsServer } from "./app";
@@ -23,3 +27,10 @@ process.on("SIGINT", function () {
   served.stop();
   process.exit(0);
 });
+
+performance.mark("startup-end");
+
+performance.measure("startup", "startup-begin", "startup-end");
+for (const entry of performance.getEntriesByName("startup")) {
+  log.info(`Startup took ${entry.duration} ms`);
+}