-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ec5408a
Showing
10 changed files
with
9,163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/vendor | ||
.env | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Jamie Schouten [email protected] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# Database status card for Laravel Pulse | ||
|
||
Get real-time insights into the status of your dabase | ||
|
||
## Example | ||
|
||
![example](example.png) | ||
|
||
## Installation | ||
|
||
Install the package using Composer: | ||
|
||
```shell | ||
composer require maantje/pulse-database | ||
``` | ||
|
||
## Register the recorder | ||
|
||
In your `pulse.php` configuration file, register the DatabaseRecorder with the desired settings: | ||
|
||
```php | ||
return [ | ||
// ... | ||
|
||
'recorders' => [ | ||
\Maantje\Pulse\Database\Recorders\DatabaseRecorder::class => [ | ||
'connections' => [ | ||
'mysql_another' => [ | ||
'values' => [ | ||
'Connections', | ||
'Threads_connected', | ||
'Threads_running', | ||
'Innodb_buffer_pool_reads', | ||
'Innodb_buffer_pool_read_requests', | ||
'Innodb_buffer_pool_pages_total', | ||
'Max_used_connections' | ||
], | ||
'aggregates' => [ | ||
'avg' => [ | ||
'Threads_connected', | ||
'Threads_running', | ||
'Innodb_buffer_pool_reads', | ||
'Innodb_buffer_pool_read_requests', | ||
'Innodb_buffer_pool_pages_total', | ||
], | ||
'max' => [ | ||
// | ||
], | ||
'count' => [ | ||
// | ||
], | ||
], | ||
], | ||
'mysql' => [ | ||
'values' => [ | ||
'Connections', | ||
'Threads_connected', | ||
'Threads_running', | ||
'Innodb_buffer_pool_reads', | ||
'Innodb_buffer_pool_read_requests', | ||
'Innodb_buffer_pool_pages_total', | ||
'Max_used_connections' | ||
], | ||
'aggregates' => [ | ||
'avg' => [ | ||
'Threads_connected', | ||
'Threads_running', | ||
'Innodb_buffer_pool_reads', | ||
'Innodb_buffer_pool_read_requests', | ||
'Innodb_buffer_pool_pages_total', | ||
], | ||
'max' => [ | ||
// | ||
], | ||
'count' => [ | ||
// | ||
], | ||
], | ||
] | ||
] | ||
], | ||
] | ||
] | ||
``` | ||
|
||
Ensure you're running [the `pulse:check` command](https://laravel.com/docs/10.x/pulse#capturing-entries). | ||
|
||
## Add to your dashboard | ||
|
||
Integrate the card into your Pulse dashboard by [publish the vendor view](https://laravel.com/docs/10.x/pulse#dashboard-customization). | ||
and then modifying the `dashboard.blade.php` file: | ||
|
||
```diff | ||
<x-pulse> | ||
<livewire:pulse.servers cols="full" /> | ||
|
||
+ <livewire:database cols='6' title="Active threads" :values="['Threads_connected', 'Threads_running']" :graphs="[ | ||
+ 'avg' => ['Threads_connected' => '#ffffff', 'Threads_running' => '#3c5dff'], | ||
+ ]" /> | ||
|
||
+ <livewire:database cols='6' title="Connections" :values="['Connections', 'Max_used_connections']" /> | ||
|
||
+ <livewire:database cols='full' title="Innodb" :values="['Innodb_buffer_pool_reads', 'Innodb_buffer_pool_read_requests', 'Innodb_buffer_pool_pages_total']" :graphs="[ | ||
+ 'avg' => ['Innodb_buffer_pool_reads' => '#ffffff', 'Innodb_buffer_pool_read_requests' => '#3c5dff'], | ||
+ ]" /> | ||
|
||
<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" /> | ||
|
||
</x-pulse> | ||
``` | ||
|
||
And that's it! Enjoy enhanced visibility into your database status on your Pulse dashboard. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "maantje/pulse-database", | ||
"description": "A Laravel Pulse card for database status", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Jamie Schouten", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"illuminate/support": "*", | ||
"laravel/pulse": "^1.0.0@beta" | ||
}, | ||
"require-dev": { | ||
"orchestra/testbench": "^8", | ||
"mockery/mockery": "^1.5.0", | ||
"phpunit/phpunit": "^10" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Maantje\\Pulse\\Database\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Maantje\\Pulse\\Database\\DatabaseServiceProvider" | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.