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
1 parent
8872396
commit f0742e5
Showing
5 changed files
with
102 additions
and
33 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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
# Changelog | ||
|
||
All notable changes to `rename-me` will be documented in this file | ||
All notable changes to `SlowQueryNotifer` will be documented in this file | ||
|
||
## 1.0.0 - 201X-XX-XX | ||
## 1.0.0 - 2020-02-18 | ||
|
||
- initial release | ||
- Initial release | ||
- Get an email if you violate the threshold | ||
- Configure the threshold in your app service provider | ||
- Enable/disable in your environment file |
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 |
---|---|---|
@@ -1,22 +1,85 @@ | ||
# Deliverables | ||
# Slow Query Notifier for Laravel | ||
|
||
## Install & Config | ||
- Set threshold in code | ||
- Set email address in code | ||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/thomasjohnkane/slow-query-notifier.svg?style=flat-square)](https://packagist.org/packages/thomasjohnkane/slow-query-notifier) | ||
[![Build Status](https://img.shields.io/travis/thomasjohnkane/slow-query-notifier/master.svg?style=flat-square)](https://travis-ci.org/thomasjohnkane/slow-query-notifier) | ||
[![Quality Score](https://img.shields.io/scrutinizer/g/thomasjohnkane/slow-query-notifier.svg?style=flat-square)](https://scrutinizer-ci.com/g/thomasjohnkane/slow-query-notifier) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/thomasjohnkane/slow-query-notifier.svg?style=flat-square)](https://packagist.org/packages/thomasjohnkane/slow-query-notifier) | ||
|
||
## Threshold Notifications | ||
- Run test command via command line to get test notification | ||
- Receive notification when threshold is met | ||
- Handle queuing (graceful) | ||
Get notified if your app ever runs an objectively slow database call. | ||
|
||
## Error handling | ||
- Handle errors silently (catch statement, logging) | ||
## Installation | ||
|
||
# Steps | ||
- [X] Install orchestra testbench (Laravel Collective) | ||
- [X] Build tests | ||
- [ ] Benchmark performance impact (seed data with package, and without...laravel start time diff??) | ||
- [ ] Branding/marketing planning with Caleb | ||
- [ ] Update Readme | ||
You can install the package via composer: | ||
|
||
```bash | ||
composer require thomasjohnkane/slow-query-notifier | ||
``` | ||
## Usage | ||
### Set an email address | ||
```bash | ||
// app/Providers/AppServiceProvider.php | ||
|
||
use SlowQueryNotifier\SlowQueryNotifierFacade as SlowQueryNotifier; | ||
|
||
public function boot() | ||
{ | ||
SlowQueryNotifier::toEmail('admin@example.com'); | ||
} | ||
``` | ||
## Test it works | ||
```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, <a href="#">read the blog post</a>. | ||
|
||
## Threshold | ||
|
||
The default is 99ms. Set a different `threshold` in milliseconds in your configuration: | ||
```bash | ||
SlowQueryNotifier::threshold(200)->toEmail('admin@example.com'); | ||
``` | ||
### Enable/Disable | ||
|
||
The 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 thomasjohnkane@gmail.com 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). |
This file was deleted.
Oops, something went wrong.
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
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