Ignoring collected data
Ignoring exceptions
By default, all exceptions will be reported to Flare. You can change this behaviour by filtering the exceptions with a callable:
use \Spatie\LaravelFlare\Facades\Flare;
Flare::filterExceptionsUsing(
fn(Throwable $throwable) => !$throwable instanceof AuthorizationException
);
Ignoring reports
Additionally, you can provide a callable to the Flare::filterReportsUsing method to stop a report from being sent to Flare. Compared to filterExceptionsUsing, which only receives Exception instances, this callable runs for every report, including PHP errors such as a TypeError. It receives the full report, so you can decide based on its contents.
use Spatie\FlareClient\ReportFactory;
Flare::filterReportsUsing(function(ReportFactory $report) {
// return a boolean to control whether the report should be sent to Flare
return true;
});
Ignoring errors
You can set the levels of errors reported to Flare using the report_error_levels key in your config/flare.php file:
// config/flare.php
'report_error_levels' => E_ALL & ~E_NOTICE,
This example sends every error level except E_NOTICE. Set the value to null to send every error level.
Ignoring spans
At the moment, it is not possible to filter out spans since they depend on each other. Removing spans would break the inheritance required for performance monitoring.
Ignoring Flare data collection
Flare collects a lot of data by default. We define many types of collects (queries, requests, etc.) that are sent to Flare. You can ignore these collects in the collects key in your flare.php config file.