1. Go to this page and download the library: Download umbrellio/jaravel 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/ */
declare(strict_types=1);
namespace App\Jobs;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Umbrellio\Jaravel\Middleware\JobTracingMiddleware;
class JaravelTestJob implements ShouldQueue
{
use InteractsWithQueue;
public function handle()
{
...
}
public function middleware()
{
return [new JobTracingMiddleware()];
}
}
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use Umbrellio\Jaravel\HttpTracingMiddlewareFactory;
$stack = HandlerStack::create();
$stack->push(HttpTracingMiddlewareFactory::create());
$client = new Client(['handler' => $stack]);
use App\Services\MyService;
use OpenTracing\Tracer;
use Umbrellio\Jaravel\Services\Span\SpanCreator;
use Umbrellio\Jaravel\Services\Span\SpanTagHelper;
// You should use dependency injection in your code, it`s just an example
$spanCreator = app(SpanCreator::class);
$myService = app(MyService::class);
$tracer = app(Tracer::class);
// First you need to create a span. It will be a child of current active span, if active span exists
$span = $spanCreator->create('Call MyService');
// Do something
$myService->doSomething();
// Close active scope (span will be finished automatically) and flush tracer.
optional($tracer->getScopeManager()->getActive())->close();
$tracer->flush();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.