Files
llama-swap/ui-svelte/vite.config.ts
T
Benson Wong 7e3e94a08a proxy,ui: add performance monitoring with Prometheus metrics (#743)
Add a comprehensive performance monitoring system that collects CPU, memory, swap, load average, network IO, and GPU stats. Provides both a REST API for the UI and a Prometheus /metrics endpoint.

Backend changes:
- New internal/perf package with configurable interval-based stats collection
- GPU monitoring via LACT (Unix socket) and nvidia-smi fallback on Linux
- Ring buffer (internal/ring) for time-series stat storage
- Prometheus /metrics endpoint with all system and GPU metrics
- Moved LogMonitor to internal/logmon package
- New PerformanceConfig for hot-reloadable monitoring settings
- REST /api/performance endpoint replacing SSE streaming

UI changes:
- New Performance page with real-time charts for CPU, memory, GPU, and network
- Reusable PerformanceChart component
- LLAMA_SWAP_URL environment variable support
- Improved capture dialog display

Other:
- Example Grafana dashboard for Prometheus metrics
- monitor-test standalone binary
- Config schema and example updates

fixes #596
2026-05-09 13:29:22 -07:00

41 lines
1.0 KiB
TypeScript

import { defineConfig } from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import tailwindcss from "@tailwindcss/vite";
import { compression } from "vite-plugin-compression2";
// https://vite.dev/config/
export default defineConfig({
plugins: [
svelte(),
tailwindcss(),
compression({
algorithm: "gzip",
exclude: [/\.(br)$/, /\.(gz)$/],
threshold: 1024,
}),
compression({
algorithm: "brotliCompress",
exclude: [/\.(br)$/, /\.(gz)$/],
threshold: 1024,
filename: "[path][base].br",
}),
],
base: "/ui/",
build: {
outDir: "../proxy/ui_dist",
assetsDir: "assets",
},
server: {
// yes very insecure but who's running this thing
// on the public internet for dev?! haha.
host: "0.0.0.0",
allowedHosts: true,
proxy: Object.fromEntries(
["/api", "/logs", "/upstream", "/unload", "/v1", "/sdapi"].map((path) => [
path,
process.env.LLAMA_SWAP_URL ?? "http://localhost:8080",
]),
),
},
});