metrics

Prometheus metrics for request latency

During an incident, the first question is usually ‘is it getting worse?’, and log lines don’t answer that well. Prometheus-style metrics make it easy to track rates and percentiles over time. I instrument request duration as a histogram and label by m

Query performance monitoring and profiling

Performance monitoring identifies slow queries and bottlenecks. I use EXPLAIN ANALYZE to profile query execution. pgstatstatements tracks query statistics over time. Slow query logs capture problematic queries. Query execution time, I/O, and buffer us

expvar counters for quick-and-dirty production introspection

Sometimes you want a quick diagnostic without wiring a full metrics stack. expvar exposes variables at /debug/vars in a standard JSON format. I use it for a handful of counters like “requeststotal” and “jobsfailed” when I’m bootstrapping a service or

API monitoring with custom instrumentation

Production visibility requires more than basic request logging. I instrument critical code paths using ActiveSupport::Notifications to publish custom metrics that monitoring services consume. Each instrumented block publishes events with timing data,

Actuator for production monitoring

Spring Boot Actuator provides production-ready features—health checks, metrics, info endpoints. /actuator/health shows application status for load balancers. /actuator/metrics exposes JVM metrics, HTTP stats, custom metrics. /actuator/info displays ap

Prometheus metrics middleware capturing status + duration

I like to start observability with two metrics: request duration and response codes. The wrapper below intercepts WriteHeader to capture status codes and then records both a histogram observation and a counter increment. The biggest gotcha is label ca

Database observability and monitoring metrics

Observability provides insight into database health and performance. I monitor key metrics—queries per second, connection count, cache hit ratio. Slow query logs identify performance problems. Query latency percentiles show user experience. Lock wait

Time-series data and TimescaleDB optimization

Time-series data tracks measurements over time—metrics, logs, sensor data. I use TimescaleDB for time-series workloads. Hypertables automatically partition by time. Continuous aggregates precompute rollups. Time-based retention policies auto-delete ol