- Install prom-client library for Prometheus metrics - Create src/lib/server/metrics.ts with default Node.js process metrics - Add /metrics endpoint that returns Prometheus-format text - Exposes CPU, memory, heap, event loop metrics Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
8 lines
267 B
TypeScript
8 lines
267 B
TypeScript
import { Registry, collectDefaultMetrics } from 'prom-client';
|
|
|
|
// Create a custom registry for metrics
|
|
export const registry = new Registry();
|
|
|
|
// Collect default Node.js process metrics (CPU, memory, event loop, etc.)
|
|
collectDefaultMetrics({ register: registry });
|