PHP code example of 0to10 / observability-php

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

    

0to10 / observability-php example snippets




ERO2TEN\Observability\Client;
use ZERO2TEN\Observability\APM\Agent\NullAgent;

$nullAgent = new NullAgent();
$client = new Client($nullAgent);

try {
    // Some application code
} catch (\Exception $e) {
    $client->transaction()->recordException($e);
}

// Add a parameter to the current transaction
$client->transaction()->addParameter('user_id', 50);



ERO2TEN\Observability\Client;
use ZERO2TEN\Observability\APM\Agent\NullAgent;

$client = new Client(new NullAgent);

$browser = $client->browser();

$browser->disableAutomaticTimingScripts();



ERO2TEN\Observability\Client;
use ZERO2TEN\Observability\APM\Agent\NullAgent;

$client = new Client(new NullAgent);

$browser = $client->browser();

// Returns the header RUM script (Javascript) as string without <script> tags
$browser->getHeaderScript();

// Returns the footer RUM script (Javascript) as string without <script> tags
$browser->getFooterScript();



ouve\APM\Agents\NullAgent;
use Nouve\APM\Client;

// Creates a Client instance with the first supported AgentInterface
// implementation configured in the Client class
$client = Client::create();

// Alternatively, you can instantiate a Client instance yourself
$nullAgent = new NullAgent();
$client = new Client($nullAgent);
shell
composer