rahimi-ali / pulse-slow-mongo-queries
A Laravel Pulse card for slow MongoDB queries
Installs: 1 485
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- ext-mongodb: *
- illuminate/support: *
- laravel/pulse: ^1.0.0@beta
Requires (Dev)
- mockery/mockery: ^1.5.0
- orchestra/testbench: ^8
- phpunit/phpunit: ^10
This package is auto-updated.
Last update: 2025-03-29 01:08:28 UTC
README
Slow queries card for Laravel Pulse just for MongoDB. This package does not assume you use any specific library, the only requirement is that you should add a subscriber to the MongoDB client class used by your application to connect to mongo and run commands.
Installation
Install using Composer:
composer require rahimi-ali/pulse-slow-mongo-queries
Usage
Add the MongoCommandSubscriber to your mongoDB client:
$client = new Client('connection string', []); $client->getManager()->addSubscriber(new \RahimiAli\Pulse\SlowMongoQueries\Util\MongoSubscriber());
Add the recorder to the config/pulse.php
configuration file:
'recorders' => [ // ... \RahimiAli\Pulse\SlowMongoQueries\Recorder\SlowMongoQueriesRecorder::class => [ 'threshold' => 100_000, // in microseconds 'sample_rate' => 1, // between 0 and 1 ] ]
Add the card to your pulse dashboard:
<x-pulse> <livewire:pulse.servers cols="full" /> <livewire:pulse.usage cols="4" rows="3" /> <livewire:pulse.queues cols="4" /> <livewire:pulse.cache cols="4" /> <livewire:pulse.slow-queries cols="8" /> <livewire:slow-mongo-queries cols="8" /> {{-- this is rendered under the slow queries card --}} <livewire:pulse.exceptions cols="6" /> <livewire:pulse.slow-requests cols="6" /> <livewire:pulse.slow-jobs cols="6" /> <livewire:pulse.slow-outgoing-requests cols="6" /> </x-pulse>