PHP code example of aleteus / prometheus_client_php

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

    

aleteus / prometheus_client_php example snippets


            
            $parameters = [
                'name1' => $var1,
                'name2' => $var2,
                'name3' => $var3
            ];
            
            $prometheus = new PrometheusClient(
                '*:9091', 
                'nome', 
                'da_metrica', 
                'produto', 
                $parameters, 
                'tipo da metrica (histogram, counter ou gauge)', 'nome_da_aplicação');  
               
                $prometheus->pushGateway($timeProcess, $parameters, $help);


$prometheus = new PrometheusClient(
                '*:9091', 
                'nome', 
                'da_metrica', 
                'produto', 
                $parameters, 
                'tipo da metrica (histogram, counter ou gauge)', 'nome_da_aplicação');  
               
                $prometheus->pushGateway($timeProcess, $parameters, $help);

$prometheus->pushGateway($timeProcess, $parameters, $help);
sh
composer