Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

752 B
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */
import { Logger } from "./Logger";

export async function reportVitals() {
  if (typeof document === "undefined") {
    return;
  }

  const { onLCP, onINP, onCLS } = await import("web-vitals");
  Logger.debug("Reporting vitals");
  const logMetric = (metric: {
    name: string;
    value: number;
    rating: string;
  }) => {
    const color =
      metric.rating === "good"
        ? "green"
        : metric.rating === "needs-improvement"
          ? "orange"
          : "red";
    Logger.log(
      `%c [Metric ${metric.name}] ${metric.value}`,
      `background:${color}; color:white; padding:2px 0; border-radius:2px`,
    );
  };
  onCLS(logMetric);
  onINP(logMetric);
  onLCP(logMetric);
}