-
Notifications
You must be signed in to change notification settings - Fork 0
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
ebaa420
commit 94b8d32
Showing
1 changed file
with
58 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,58 @@ | ||
# Pluggit Monitoring | ||
|
||
Monitoring is a monitor factory system, which gives you ability to log information. | ||
|
||
## Instalation | ||
|
||
Add this repo to your composer.json | ||
|
||
````json | ||
"repositories": { | ||
"pluggit/monitoring": { | ||
"type": "vcs", | ||
"url": "git@github.com:CMProductions/monitoring.git" | ||
} | ||
} | ||
```` | ||
|
||
Then require it as usual: | ||
|
||
``` bash | ||
composer require "pluggit/monitoring" | ||
``` | ||
|
||
To create factory, set default channel name as first parameter and Formatter as second one. | ||
```php | ||
<?php | ||
use Cmp\Monitoring\Event\EventFactory; | ||
use Cmp\Monitoring\Metric\MetricFactory; | ||
use Cmp\Monitoring\Monitor; | ||
use Psr\Log\LoggerInterface; | ||
|
||
/** | ||
* @var LoggerInterface $logger | ||
**/ | ||
$logger; | ||
$metricFactory = new MetricFactory($app['monitoring.default_tags']); | ||
$eventFactory = new EventFactory('host_name' [ | ||
'env' => $app['environment'], | ||
'mode' => $app['mode'] | ||
]); | ||
|
||
$logger = new Monitor($metricFactory, $eventFactory, $logger); | ||
``` | ||
## Handlers | ||
### Adding senders | ||
Sender should implement ``Cmp\Monitoring\Metric\SenderInterface`` | ||
The library provides two types of senders, DataDox and Monolog | ||
To add sender, use ``pushMetricSender()`` method | ||
```php= | ||
$monitor->pushMetricSender($sender); | ||
``` | ||
|
||
## Usage | ||
```php | ||
<?php | ||
$tags = ['app' => 'fun application']; | ||
$monitor->increment('tag.tag', $tags); | ||
``` |