tanjilahmed87@gmail.com

DevOps6 min read

Setting Up Observability with Prometheus and Grafana for a Laravel App

Logs tell you what happened. Metrics tell you it's happening right now. A Laravel app needs both, and Prometheus plus Grafana gets you the second half cheaply.

Tanjil Ahmed

Lead Software Engineer · Notionhive

Most Laravel apps ship with solid logging and no metrics at all, which means the first sign of a problem is a user complaint or a log line someone happens to grep for after the fact. Metrics close that gap — they tell you something is degrading before a customer has to tell you first.

  • Expose a `/metrics` endpoint with request duration histograms, queue depth, and job failure counts as a starting set.
  • Grafana dashboards for the four golden signals — latency, traffic, errors, saturation — cover most incidents before custom metrics are needed.
  • Alert on rate-of-change, not just absolute thresholds — a queue depth that's climbing steadily matters before it hits a fixed number.
  • Correlate metrics with log aggregation (a shared trace ID) so a spike on a graph leads straight to the relevant log lines.

The setup cost is a day or two, and the return is finding out about degradation from a dashboard instead of a support ticket — which, on every production system I've operated, has been worth far more than the initial time investment.

Logs tell a story after the fact. Metrics are the story happening live, which is the only version that lets you act before the user notices.