Skip to main content

Metrics

PrismMetrics collects request-level statistics — how many requests your server handled, how fast it responded, which endpoints are hot, and how many errors occurred. All exposed through a /metrics endpoint.

Quick Setup

Enable Metrics
Every request (except to /metrics itself) is automatically tracked.

What’s Tracked

GET /metrics Response

Custom Metrics Path

Custom Path

Programmatic Access

Read metrics from your own code — useful for logging or alerting:
Read Metrics Snapshot

Manual Recording

Record metrics from outside the middleware pipeline:
Manual Metrics

Reset Metrics

Reset

Combining with Health Checks

Metrics-Aware Health Check
Place PrismMetricsMiddleware early in your middleware stack so it captures the full request lifecycle, including time spent in other middleware. Middleware runs in order — earlier middleware wraps later middleware.