social components inlay.at
atproto components sdui
86
fork

Configure Feed

Select the types of activity you want to include in your feed.

add memory instrumentation

+20
+20
instrumentation.ts
··· 1 + export function register() { 2 + if (process.env.NEXT_RUNTIME === "nodejs") { 3 + let lastHeapMB = 0; 4 + 5 + setInterval(() => { 6 + const mem = process.memoryUsage(); 7 + const heapMB = Math.round(mem.heapUsed / 1024 / 1024); 8 + const rssMB = Math.round(mem.rss / 1024 / 1024); 9 + const delta = heapMB - lastHeapMB; 10 + const arrow = 11 + delta > 5 ? ` ⚠ +${delta}MB` : delta < -5 ? ` ↓ ${delta}MB` : ""; 12 + console.log( 13 + `[memory] heap=${heapMB}MB rss=${rssMB}MB uptime=${Math.round(process.uptime())}s${arrow}` 14 + ); 15 + lastHeapMB = heapMB; 16 + }, 10_000).unref(); 17 + 18 + console.log("[memory] tracking started"); 19 + } 20 + }