From 412a295d49f9572c22df9df2b337b3c4abba388a Mon Sep 17 00:00:00 2001 From: Till Backhaus Date: Thu, 24 May 2018 15:28:54 +0200 Subject: [PATCH] Update README --- README.md | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index f574d66..7a17169 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ # laravel-prometheus-exporter +[![Build Status](https://travis-ci.org/traum-ferienwohnungen/laravel-prometheus-exporter.svg?branch=master)](https://travis-ci.org/traum-ferienwohnungen/laravel-prometheus-exporter) + A prometheus exporter for the Laravel and the Lumen web framework. -It tracks latency and request counts by -request method, route and response code. +It tracks latency and request counts by request method, route and response code. ## Project State -This is unreleased software. I commit backwards incompatible changes without notice. Heck, I don't even have CI setup yet. +This is unreleased software. I commit backwards incompatible changes without notice. ## Installation `composer require traum-ferienwohnungen/laravel-prometheus-exporter` @@ -16,7 +17,7 @@ Then choose from two storage adapters: APCu is the default option. Redis can also be used. #### APCu -Ensure apcu (apcu-bc for php7) is installed and enabled. +Ensure apcu-bc is installed and enabled. #### Redis Ensure php redis is installed and enabled. @@ -25,15 +26,6 @@ By default it looks for a redis server at localhost:6379. The server can be configured in `config/prometheus_exporter.php`. ### Laravel -#### Register the ServiceProvider -In `config/app.php` -``` -'providers' => [ - ... - traumferienwohnungen\PrometheusExporter\LpeServiceProvider::class, -]; -``` - #### Enable the Middleware In `app/Http/Kernel.php` ``` @@ -45,30 +37,20 @@ protected $middleware = [ #### Add an endpoint for the metrics ``` -Route::get('metrics', \traumferienwohnungen\PrometheusExporter\LpeController::class . '@metrics'); +Route::get('metrics', \traumferienwohnungen\PrometheusExporter\LaravelController::class . '@metrics'); ``` ### Lumen #### Register the ServiceProvider In `bootstrap/app.php` ``` -$app->register(\traumferienwohnungen\PrometheusExporter\LpeServiceProvider::class); -``` - -#### Enable the Middleware -In `bootstrap/app.php` -``` -$app->middleware([ - \traumferienwohnungen\PrometheusExporter\Middleware\LumenResponseTimeMiddleware::class -]); +$app->register(traumferienwohnungen\PrometheusExporter\LumenServiceProvider::class); ``` #### Add an endpoint for the metrics In `bootstrap/app.php` ``` -$app->group(['namespace'=> '\traumferienwohnungen\PrometheusExporter'], function() use ($app){ - $app->get('metrics', ['as' => 'metrics', 'uses'=> 'LpeController@metrics']); -}); +$app->router->get('metrics', ['as' => 'metrics', 'uses'=> 'traumferienwohnungen\PrometheusExporter\LumenController@metrics']); ``` ## Configuration @@ -81,11 +63,3 @@ The configuration can be found in `config/prometheus_exporter.php`. | namespace_http_server | name (prefix) to use for http latency in prometheus metrics. default: 'http_server' | | redis | array of redis parameters. see prometheus_exporter.php for details | -## Usage -``` -$manager = app('LpeManager'); - -$manager->incCounter('NAME', 'HELP', 'NAMESPACE', 'LABELS', 'DATA'); - -$manager->incByCounter('NAME', 'HELP', 'VALUE', 'NAMESPACE', 'LABELS', 'DATA'); -```