mlx-bun library API
    Preparing search index...
    manifest: {
        id: "metrics";
        jobs: readonly [
            { gpu: "exclusive"; isolation: "task"; kind: "bench-serve" },
        ];
        panel: {
            entry: "@mlx-bun/module-metrics/panel";
            path: "/metrics";
            tag: "mlx-metrics-panel";
            title: "Metrics";
        };
        requires: readonly ["events", "storage", "jobs"];
        routes: readonly [
            {
                id: "snapshot";
                method: "GET";
                path: "/snapshot";
                response: "json";
                summary: "The current metrics as JSON: models, scheduler, caches, request-timing distributions and a throughput series";
            },
            {
                id: "stream";
                method: "GET";
                path: "/stream";
                response: "sse";
                summary: "The same snapshot as a server-sent stream: one `snapshot` event on connect, then one each time the metrics change (at most twice a second)";
            },
            {
                id: "history";
                method: "GET";
                path: "/history";
                response: "json";
                summary: "Finished bench-serve runs, newest first, as compact per-cell medians (`limit` query)";
            },
            {
                id: "history-entry";
                method: "GET";
                path: "/history/:id";
                response: "json";
                summary: "One finished bench-serve run";
            },
            {
                id: "profiles";
                method: "GET";
                path: "/bench/profiles";
                response: "json";
                summary: "The bench-serve plans a run can start from";
            },
            {
                id: "bench-start";
                method: "POST";
                path: "/bench";
                response: "json";
                summary: "Start a bench-serve run from a profile name in the JSON body (`profile`); it takes the GPU exclusively until it ends";
            },
            {
                id: "bench-list";
                method: "GET";
                path: "/bench";
                response: "json";
                summary: "Recent bench-serve jobs";
            },
            {
                id: "bench-job";
                method: "GET";
                path: "/bench/:id";
                response: "json";
                summary: "One bench-serve job";
            },
            {
                id: "bench-cancel";
                method: "DELETE";
                path: "/bench/:id";
                response: "json";
                summary: "Stop a running bench-serve job";
            },
        ];
        storage: readonly [
            {
                key: "history";
                kind: "directory";
                path: "metrics/history";
                purpose: "Compact results of finished bench-serve runs, one JSON file each";
            },
            {
                key: "bench";
                kind: "directory";
                path: "metrics/bench";
                purpose: "bench-serve plans (plans/) and each run's full record and report (runs/)";
            },
        ];
        summary: "Live serving metrics from the host's events (tokens per second, time to first token, batch occupancy, queue depth, KV and prefix-cache usage, memory and load times per model) and the history of bench-serve runs.";
        title: "Metrics and performance";
    } = ...

    Type Declaration

    • Readonlyid: "metrics"
    • Readonlyjobs: readonly [{ gpu: "exclusive"; isolation: "task"; kind: "bench-serve" }]
    • Readonlypanel: {
          entry: "@mlx-bun/module-metrics/panel";
          path: "/metrics";
          tag: "mlx-metrics-panel";
          title: "Metrics";
      }
    • Readonlyrequires: readonly ["events", "storage", "jobs"]
    • Readonlyroutes: readonly [
          {
              id: "snapshot";
              method: "GET";
              path: "/snapshot";
              response: "json";
              summary: "The current metrics as JSON: models, scheduler, caches, request-timing distributions and a throughput series";
          },
          {
              id: "stream";
              method: "GET";
              path: "/stream";
              response: "sse";
              summary: "The same snapshot as a server-sent stream: one `snapshot` event on connect, then one each time the metrics change (at most twice a second)";
          },
          {
              id: "history";
              method: "GET";
              path: "/history";
              response: "json";
              summary: "Finished bench-serve runs, newest first, as compact per-cell medians (`limit` query)";
          },
          {
              id: "history-entry";
              method: "GET";
              path: "/history/:id";
              response: "json";
              summary: "One finished bench-serve run";
          },
          {
              id: "profiles";
              method: "GET";
              path: "/bench/profiles";
              response: "json";
              summary: "The bench-serve plans a run can start from";
          },
          {
              id: "bench-start";
              method: "POST";
              path: "/bench";
              response: "json";
              summary: "Start a bench-serve run from a profile name in the JSON body (`profile`); it takes the GPU exclusively until it ends";
          },
          {
              id: "bench-list";
              method: "GET";
              path: "/bench";
              response: "json";
              summary: "Recent bench-serve jobs";
          },
          {
              id: "bench-job";
              method: "GET";
              path: "/bench/:id";
              response: "json";
              summary: "One bench-serve job";
          },
          {
              id: "bench-cancel";
              method: "DELETE";
              path: "/bench/:id";
              response: "json";
              summary: "Stop a running bench-serve job";
          },
      ]
    • Readonlystorage: readonly [
          {
              key: "history";
              kind: "directory";
              path: "metrics/history";
              purpose: "Compact results of finished bench-serve runs, one JSON file each";
          },
          {
              key: "bench";
              kind: "directory";
              path: "metrics/bench";
              purpose: "bench-serve plans (plans/) and each run's full record and report (runs/)";
          },
      ]
    • Readonlysummary: "Live serving metrics from the host's events (tokens per second, time to first token, batch occupancy, queue depth, KV and prefix-cache usage, memory and load times per model) and the history of bench-serve runs."
    • Readonlytitle: "Metrics and performance"