PHP code example of shish / microotlp

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

    

shish / microotlp example snippets


use MicroOTLP\Client;

$c = new Client('http://localhost:4318');

$topSpan = $c->startSpan('my-span');
  $childSpan1 = $c->startSpan('initialising-stuff');
    $c->logMessage("Initialising stuff");
  $childSpan1->end();
  $childSpan2 = $c->startSpan('doing-stuff');
    $c->logMessage("Doing stuff");
    $c->logCounter("number.of.things.done", 1);
    $c->logGauge("current.thing.in.progress", 42);
  $childSpan2->end();
$topSpan->end();

$c->flush();