Adding a bunch of performance markers (#6303)

* Adding a bunch of performance markers

* Update packages/lib/server/perfObserver.ts

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2023-01-09 18:42:46 -07:00
1 parent e70d179628
commit 8b873e2828
3 files changed
+22 -17

No files matched your search

+3 -2
View File
@@ -1,5 +1,7 @@
import { PerformanceObserver } from "perf_hooks";
import logger from "../logger";
declare global {
// eslint-disable-next-line no-var
var perfObserver: PerformanceObserver | undefined;
@@ -9,8 +11,7 @@ export const perfObserver =
new PerformanceObserver((items) => {
items.getEntries().forEach((entry) => {
// Log entry duration in seconds with four decimal places.
if (!!process.env.NEXT_PUBLIC_DEBUG)
console.log(entry.name.replace("$1", `${(entry.duration / 1000.0).toFixed(4)}s`));
logger.debug(entry.name.replace("$1", `${(entry.duration / 1000.0).toFixed(4)}s`));
});
});