PHP code example of gustamms / prometheus-laravel

1. Go to this page and download the library: Download gustamms/prometheus-laravel 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/ */

    

gustamms / prometheus-laravel example snippets


use Gustamms\PrometheusLaravel\PrometheusCollector;

class DoSomething 
{
    private $collector;
    
    public function __construct() {
        $this->collector = new PrometheusCollector();
    }
    
    public function do(){
        $this->collector->getOrRegisterCounter(
            'do_method_use',
            'Pass in Do method'
        );
        
        $this->collector->getOrRegisterHistogram(
            'histogram_sample',
            'Histogram are made',
            1.2,
            ['label1'],
            ['labelvalue1']
        );
    }
}