Outsource Laravel Development Partner - $3200/Month | Bacancy

Laravel performance monitoring in Honeybadger

Published on by

Laravel performance monitoring in Honeybadger image

Great news, Laravel friends! You can now monitor the performance of your Laravel apps with Honeybadger.

Yes, you read that right: Laravel performance monitoring in Honeybadger! Many of you have asked for this, and we're excited to tell you about it.

Earlier this year, we launched Honeybadger Insights, a new logging and performance monitoring tool bundled with Honeybadger. Insights allows you to query your logs and events to diagnose performance issues, perform root-cause analyses, and create charts and dashboards to see what's happening in real time. It also works automatically with Honeybadger’s best-in-class error tracking, unlocking direct access to query and analyze your error data.

Today, we’re turning Insights up a notch with two new features just for Laravel developers:

  1. A new Laravel performance dashboard. Instead of creating a dashboard from scratch, select “ Laravel” from our list of curated monitoring dashboards. The new dashboard allows you to monitor requests and background jobs, slow requests and queries, and more.
  2. Laravel performance instrumentation. Our composer package now automatically sends performance events and metrics from Laravel. The new instrumentation is what powers your dashboard, but you can also use our query language—BadgerQL—to dig into the data yourself.

The Laravel Performance Dashboard

When creating a dashboard in Honeybadger, you have several options. To get started, select the new “ Laravel” dashboard from the list:

Our team curates each dashboard to make it easy for you to ramp up with Honeybadger and BadgerQL. Install a monitoring integration (such as our composer package), select the matching dashboard, and you're done.

We recently deployed a production Laravel app at Honeybadger (Statamic, it’s fantastic!). Here’s what our dashboard looks like:

Honeybadger’s new Laravel Performance Dashboard

The new Laravel dashboard includes the following widgets by default:

  • Request counts — A line chart of the number of requests to your Laravel app over time. Know immediately when you have a spike and when traffic is steady.
  • Response distributions — A bar chart that shows the response distributions binned by 100ms. See how a majority of your requests are performing.
  • Job durations — A line chart showing the average duration for each of your Laravel jobs. Helps you keep the processing pipeline optimized.
  • Responses — A line chart showing the number of responses grouped by status code. Are you having a spike in 403 Forbidden responses? This chart will tell you about it.
  • Slowest controllers — Your slowest Laravel controllers, with Apdex scores based on 200ms response times. This table tells you where you can improve performance.
  • Slowest 10 requests — Your slowest requests by controller and duration. Use the included Request ID to query for events that happened during that request (such as a slow SQL query, N+1 queries, etc.).
  • Slowest queries per request — Quickly see your slowest queries, including the average & max duration per Request ID.
  • Slowest 10 outgoing requests — Your slowest outgoing requests, like when you call an external REST API.
  • Slowest 10 queries — Your slowest SQL queries overall.

After you create a dashboard, you don't have to keep the default widgets—we designed Honeybadger dashboards to be customized. In fact, reading the underlying queries is a great way to learn BadgerQL. To see the query and raw data behind any dashboard widget, click "Open in Query Editor":

You can tweak the query, review the results, and update the dashboard from there:

Laravel performance instrumentation

The data that feeds the new Laravel Dashboard is sent automatically from the honeybadger-laravel composer package starting in version 4.2.x—so make sure you upgrade to the latest version. After you upgrade, you'll also need to enable the Honeybadger Insights instrumentation for Laravel by adding the following to your config/honeybadger.php config file:

'events' => [
'enabled' => true
]

We'll enable this feature by default in a future package version, but you must opt in for now. After deploying the new Laravel config, some new events and metrics will begin to appear in Honeybadger Insights, and your Laravel dashboard will come alive!

We also added some new configuration and documentation to help you customize the events you care about. To learn more, check out our new Sending Events to Insights guide.

Sending custom events

You can also send your own Laravel events to Honeybadger using the Honeybadger.event method:

Honeybadger.event('user_activity', [
'action' => 'registration',
'user_id' => 123
])

The first argument is the type of the event (event_type), and the second argument is an object containing any additional data you want to include.

You can find these events with the following BadgerQL query:

fields @ts, @preview
| filter event_type::str == "user_activity"
| filter action::str == "registration"
| sort @ts

Sending your Laravel application logs

Honeybadger’s approach to logging is “Log everything, ask anything.” You don’t always know what information will be helpful when you’re troubleshooting an outage (or an error). In addition to the performance telemetry that we now record by default, you can send your Laravel application logs to Honeybadger.

There are several ways to do this:

  1. Send your logs from your infrastructure (i.e., your server, Docker containers, etc.)
  2. Use our Monolog handler
  3. Use our Laravel channel driver

Using our channel driver is the simplest way to get started in Laravel. To configure it, add our event driver to your config/logging.php config file:

'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single', 'honeybadger'],
'ignore_exceptions' => false,
],
'honeybadger' => [
'driver' => 'custom',
'via' => Honeybadger\HoneybadgerLaravel\HoneybadgerLogEventDriver::class,
'name' => 'honeybadger',
'level' => 'info',
],
],

Now you can write log messages as usual with Laravel's log facade, and they'll show up in Honeybadger:

Log::info('An info message');
Log::error('An error message with context', ["some-key" => "some-value"]);

And, of course, this also works for Lumen!

Laravel performance monitoring in Honeybadger

To try out the new Laravel performance monitoring features in Honeybadger, all you need to do is sign up for a free Honeybadger account. We include 50MB/day (1.5GB/month) ingest for free, and you can upgrade to a paid plan if you need more. Our pricing is reasonable, too! Honeybadger is almost 8 times cheaper than Papertrail for logging. 🤯

Whew! That was a lot to get through, and we’re just scratching the surface of our roadmap for performance monitoring in Laravel. Questions or comments? Schedule a call with us to learn how Honeybadger can help streamline your monitoring stack and your costs.

Joshua Wood photo

Joshua Wood is a software developer and the co-founder of Honeybadger.io — the full-stack web application monitoring tool for developers.

Filed in:
Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Bacancy

Outsource a dedicated Laravel developer for $3,200/month. With over a decade of experience in Laravel development, we deliver fast, high-quality, and cost-effective solutions at affordable rates.

Visit Bacancy
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit

The latest

View all →
Clawdbot Rebrands to Moltbot After Trademark Request From Anthropic image

Clawdbot Rebrands to Moltbot After Trademark Request From Anthropic

Read article
Automate Laravel Herd Worktrees with This Claude Code Skill image

Automate Laravel Herd Worktrees with This Claude Code Skill

Read article
Laravel Boost v2.0 Released with Skills Support image

Laravel Boost v2.0 Released with Skills Support

Read article
Laravel Debugbar v4.0.0 is released image

Laravel Debugbar v4.0.0 is released

Read article
Radiance: Generate Deterministic Mesh Gradient Avatars in PHP image

Radiance: Generate Deterministic Mesh Gradient Avatars in PHP

Read article
Speeding Up Laravel News With Cloudflare image

Speeding Up Laravel News With Cloudflare

Read article