Configuration

Customize the monitoring strategy in your Laravel application.

If you want full control of the package behaviour publish the configuration file:

php artisan vendor:publish --provider="Inspector\Laravel\InspectorServiceProvider"

This comand will create the config/inspector.php file.

Environment Variables

You can use the following environment variables to determine how Inspector will collect information for your application:

Variable

Type

Default

Description

INSPECTOR_API_KEY

string

Your application key to identify uniquely your application in Inspector.

INSPECTOR_ENABLE

boolean

true

Enable/Disable data transfer from your app to Inspection API.

INSPECTOR_TRANSPORT

string

async

Tha way the package sends data to the inspection API. sync (using php curl extension), async (in a background process)

INSPECTOR_MAX_ITEMS

integer

100

Max numebr of items recorded during an execution cycle.

INSPECTOR_QUERY

boolean

true

Determine if Inspector should report database queries.

INSPECTOR_QUERY_BINDINGS

boolean

false

Determine if Inspector should report binding values for queries.

INSPECTOR_USER

boolean

true

Determine if Inspector should attach user information in your events.

INSPECTOR_EMAIL

boolean

true

Determine if Inspector should report emails.

INSPECTOR_NOTIFICATIONS

boolean

true

Determine if Inspector should report notifications.

INSPECTOR_JOB

boolean

true

Determine if Inspector should report queued jobs execution.

INSPECTOR_VIEWS

boolean

true

Determine if Inspector should report views rendering stats.

INSPECTOR_UNHANDLED_EXCEPTIONS

boolean

true

Determine if Inspector should report unhandled exception fired in your application.

INSPECTOR_REDIS

boolean

true

Determine if Inspector should report redis command.

INSPECTOR_HTTP_CLIENT

boolean

true

Determine if Inspector should report Http requests done using the Laravel Http Client

INSPECTOR_HTTP_CLIENT_BODY

boolean

false

Determine if Inspector should report Http client response body

Master Switch

If desired, you may disable data transfer setting to false the enable configuration option:

'enable' => env('INSPECTOR_ENABLE', true),

Ignore Urls, Commands, Jobs

Not all transactions need to be monitored in your application. Think about a Laravel Nova admin panel, that is built for internal use and aren't reachable by users. Or the Livewire internal HTTP requests that arent related to your business logic.

You have many options to keep off the noise, and only monitor what metter.

To add these customizations you need to publish the inspector.php configuration file. You can do it with the command below:

php artisan vendor:publish --provider="Inspector\Laravel\InspectorServiceProvider"

Ignore URLs

It could be needed to turn off monitoring based on url. Think about paths like /nova, /telescope, or other parts of your app that don't affect the user experience.

You can also use the wildcard character * to exclude all sub-paths.

/*
 |---------------------------------------------------------------------
 | Web request url to ignore
 |---------------------------------------------------------------------
 |
 | Add at this list the url schemes that you don't want monitoring
 | in your Inspector dashboard. You can also use wildcard expression (*).
 |
 */
 
'ignore_url' => [
    'telescope*',
    'vendor/telescope*',
    'horizon*',
    'vendor/horizon*',
],

Ignore Commands

You can ignore artisan commands adding the command signature to the ignore_commands parameter in the config/inspector.php configuration file.

/*
 |---------------------------------------------------------------------
 | Artisan command to ignore
 |---------------------------------------------------------------------
 |
 | Add at this list all command signature that you don't want monitoring
 | in your Inspector dashboard.
 |
 */
 
'ignore_commands' => [
    'migrate:rollback',
    'migrate:fresh',
    'migrate:reset',
    'migrate:install',
    'package:discover',
    'queue:listen',
    'queue:work',
    'horizon',
    'horizon:work',
    'horizon:supervisor',
],

Ignore Jobs

You can also ignore background jobs adding classes to the ignore_jobs property:

/*
|--------------------------------------------------------------------------
| Job classes to ignore
|--------------------------------------------------------------------------
|
| Add at this list the job classes that you don't want monitor.
|
*/

'ignore_jobs' => [
    //\App\Jobs\MyJob::class
],

Last updated