PHP code example of hans-thomas / laravel-prometheus-exporter

1. Go to this page and download the library: Download hans-thomas/laravel-prometheus-exporter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hans-thomas / laravel-prometheus-exporter example snippets


php artisan vendor:publish --provider="Hasn\PrometheusExporter\Provider\PrometheusExporterServiceProvider" --tag="config"

$router->get('/test/route', function () {
    return 'valid';
})->middleware('lpe.requestPerRoute');
config/prometheus-exporter.php

'buckets_per_route' => [
    ROUTE-NAME => [10,20,50,100,200],
    ...
]

Route::get(
    ROUTE,
    [ \Hans\PrometheusExporter\Controller\LaravelController::class, 'metrics']
);