Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix request path with / #3

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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