PHP code example of socloz / monitoring-bundle

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

    

socloz / monitoring-bundle example snippets


$requestId = $this->get("socloz_monitoring.request_id")->getRequestId();
$sql = "SELECT /* {"request_id":"$requestId"} */ * FROM my_table WHERE col = ?";

$container->get('socloz_monitoring.statsd')->updateStats("counter_name", $number);

$container->get('socloz_monitoring.statsd')->gauge("gauge_name", $number);

$start = microtime(true);
// do some stuff
$end = microtime(true);
$container->get('socloz_monitoring.statsd')->timing("timer_name", ($end-$start)*1000);

$container->get('socloz_monitoring.statsd')->flush();