Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thomasjohnkane/slow-query-notifier
Get notified if your Laravel app ever runs a really slow database query
https://github.com/thomasjohnkane/slow-query-notifier
database-query-monitoring laravel performance-monitoring
Last synced: 11 days ago
JSON representation
Get notified if your Laravel app ever runs a really slow database query
- Host: GitHub
- URL: https://github.com/thomasjohnkane/slow-query-notifier
- Owner: thomasjohnkane
- License: mit
- Created: 2020-02-01T21:58:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-02T11:00:50.000Z (almost 2 years ago)
- Last Synced: 2024-04-18T06:27:48.545Z (7 months ago)
- Topics: database-query-monitoring, laravel, performance-monitoring
- Language: PHP
- Homepage:
- Size: 175 KB
- Stars: 97
- Watchers: 2
- Forks: 7
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Slow Query Notifier for Laravel
Get notified if your app ever runs a really slow database query. We set a default threshold, but you can configure it based on your needs & expectations.
## Installation
You can install the package via composer:
```bash
composer require thomasjohnkane/slow-query-notifier
```
## Usage
### Set an email address
```php
// app/Providers/AppServiceProvider.phpuse SlowQueryNotifier\SlowQueryNotifierFacade as SlowQueryNotifier;
public function boot()
{
SlowQueryNotifier::toEmail('[email protected]');
}
```
### Test it works (in Production)
If you are using this in production (as intendend) make sure it is working correctly:
```bash
php artisan sqn:test
```
This command will test two things:- We can detect slow queries in your app
- We can send an email to you if a slow query runs## Configuration
In general, we setup all of the configuration for you with sensible defaults. However, you can change the default settings if you'd like. To learn why we chose these defaults, read the blog post.
### Threshold
The default is 99ms. Set a different `threshold` in milliseconds in your configuration:
```php
SlowQueryNotifier::threshold(200)->toEmail('[email protected]');
```
### Enable/DisableThe package is enabled by default. Set this value to `false` in your `.env` to bypass the listener.
```bash
SLOW_QUERY_NOTIFIER_ENABLED=false
```
## Testing``` bash
phpunit
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [Thomas Kane](https://github.com/thomasjohnkane)
- Thanks to Marcel Pociot for the original inspiration
- Thanks to Caleb Porzio for the guidance
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
## Laravel Package Boilerplate
This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).