Skip to content

Commit

Permalink
Prefix path with / (#3)
Browse files Browse the repository at this point in the history
Update README with more ignore patterns, make FourXxRecorder section easier to copy-paste
  • Loading branch information
onlime authored May 24, 2024
1 parent 7c25942 commit d37d1e4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 30 deletions.
48 changes: 19 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,24 @@ composer require morrislaptop/laravel-pulse-4xx

Add the `FourXxRecorder` to the `config/pulse.php` file.

```diff
```php
return [
// ...

'recorders' => [
+ \Morrislaptop\LaravelPulse4xx\FourXxRecorder::class => [
+ 'enabled' => env('PULSE_4XX_ENABLED', true),
+ 'sample_rate' => env('PULSE_4XX_SAMPLE_RATE', 1),
+ 'ignore' => [
+ '#^/wp-admin#', // Classic WordPress...
+ ],
+ ],
Morrislaptop\LaravelPulse4xx\FourXxRecorder::class => [
'enabled' => env('PULSE_4XX_ENABLED', true),
'sample_rate' => env('PULSE_4XX_SAMPLE_RATE', 1),
'ignore' => [
'#^/wp-admin#', // Classic WordPress...
'#^/wp-login#',
'#^/wp-config#',
'#^/xmlrpc\.php#',
'#^/browserconfig\.xml#', // Microsoft junk
],
],

// ...
]
]
```
Expand All @@ -44,30 +51,13 @@ To add the card to the Pulse dashboard, you must first [publish the vendor view]
php artisan vendor:publish --tag=pulse-dashboard
```

Then, you can modify the `dashboard.blade.php` file:
Then, add the card to your `resources/views/vendor/pulse/dashboard.php`:

```diff
```blade
<x-pulse>
+ <livewire:4xx cols='4' rows='2' />

<livewire:pulse.servers cols="full" />

<livewire:pulse.usage cols="4" rows="2" />

<livewire:pulse.queues cols="4" />

<livewire:pulse.cache cols="4" />

<livewire:pulse.slow-queries cols="8" />

<livewire:pulse.exceptions cols="6" />

<livewire:pulse.slow-requests cols="6" />

<livewire:pulse.slow-jobs cols="6" />

<livewire:pulse.slow-outgoing-requests cols="6" />
<livewire:4xx cols="4" rows="2" />
<!-- ... -->
</x-pulse>
```

Expand Down
3 changes: 2 additions & 1 deletion src/FourXxRecorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use Laravel\Pulse\Concerns\ConfiguresAfterResolving;
use Laravel\Pulse\Pulse;
use Laravel\Pulse\Recorders\Concerns;
Expand Down Expand Up @@ -46,7 +47,7 @@ public function record(Carbon $startedAt, Request $request, Response $response):
return;
}

$path = $request->path();
$path = Str::start($request->path(), '/');

if ($this->shouldIgnore($path)) {
return;
Expand Down

0 comments on commit d37d1e4

Please sign in to comment.