Published: April 15, 2025
3
7
119

šŸ”„ Here are some of the most basic monitoring techniques you can start using immediately: - Spatie laravel-health - Error tracking - Syntethic checks It takes ~30 minutes to set up these. 🧵 Keep Reading

Image in tweet by Martin Joo

Health checks with laravel-health The package can check: - CPU load - Disk space utilization - Database connectivity - Redis - And even query speed

Image in tweet by Martin Joo

The example contains pre-built checks. For instance, it notifies you if the average CPU load is higher than 2.5 in the last 5 minutes or 2 in the previous 15 minutes. It also notifies you if the used disk space is more than 70%

Image in tweet by Martin Joo

You can also write custom checks for your own need. For example, QuerySpeedCheck is one I wrote. It notifies you if a particular query takes too long to execute. This is what it looks like:

Image in tweet by Martin Joo

Syntethic checks For this, you can use something like Uptime Robot or Better Uptime. They send a request every minute to your site and notify you if it's unavailable or slow. Your server provider might also offer something like that. DigitalOcean looks like this:

Image in tweet by Martin Joo

You can (and should) also set resource and latency alerts. For example, this notifies me if the memory usage is higher than 70% on given servers:

Image in tweet by Martin Joo

Error tracking Instead of relying only on log files, you can install Rollbar or Sentry to track your errors in a more organized way. You only need to add a new log channel:

Image in tweet by Martin Joo

And then your provider collects your logs/errors in a more organized way than laravel.log does:

Image in tweet by Martin Joo

Thank you if you're still here! Just released a new book called Building a database engine. Check out the details here if you want to build your own database: https://thedatabasebook.com/

Share this thread

Read on Twitter

View original thread

Navigate thread

1/9