You can install the package via composer:
composer require spatie/laravel-open-telemetry
##Run the installer command
Next, you should publish the configuration using this command
php artisan open-telemetry:install
This command will create a config file in config/open-telemetry.php
looks like:
return [
'default_trace_name' => null,
'drivers' => [
Spatie\OpenTelemetry\Drivers\HttpDriver::class => [
'url' => 'http://localhost:9411/api/v2/spans',
],
],
'sampler' => Spatie\OpenTelemetry\Support\Samplers\AlwaysSampler::class,
'trace_tag_providers' => [
\Spatie\OpenTelemetry\Support\TagProviders\DefaultTagsProvider::class,
],
'span_tag_providers' => [
],
'queue' => [
'make_queue_trace_aware' => true,
'all_jobs_are_trace_aware_by_default' => true,
'all_jobs_auto_start_a_span' => true,
'trace_aware_jobs' => [
],
'not_trace_aware_jobs' => [
],
],
'actions' => [
'make_queue_trace_aware' => Spatie\OpenTelemetry\Actions\MakeQueueTraceAwareAction::class,
],
'stopwatch' => Spatie\OpenTelemetry\Support\Stopwatch::class,
'id_generator' => Spatie\OpenTelemetry\Support\IdGenerator::class,
];
It will also copy a service provider to app/Providers/OpenTelemetryServiceProvider
. This provider contains code to measure requests.
##Setting up ZipKin via Docker locally
This package transmits results to an OpenTelemetry reporting tool like ZipKin or Jaeger.
The default configuration of this package, will send measurements to ZipKin. To install ZipKin, you can use the following docker command:
docker run -d -p 9411:9411 openzipkin/zipkin
The Zipkin UI will be visible at http://localhost:9411