PHP code example of infaris / monitoring

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

    

infaris / monitoring example snippets


Infaris\Monitoring\Symfony\InfarisMonitoringBundle::class => ['all' => true],

define('INFARIS_MONITORING_API_KEY', getenv('INFARIS_MONITORING_API_KEY'));
define('SAVEQUERIES', true); // database queries as spans

$monitor = Infaris\Monitoring\Monitor::start();
$monitor->setRoute('/products/{id}');
$monitor->recordQuery('mysql', $sql, $start, microtime(true));
$monitor->recordHttpCall('GET', $url, $status, $start, microtime(true));
$monitor->captureException($e);
$monitor->log('error', 'Export failed', ['order' => 42]);
ini
; php.ini, .user.ini or the PHP-FPM pool
auto_prepend_file = /var/www/vendor/infaris/monitoring/prepend.php