Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Open Telemetry Laravel Package

spatie/laravel-open-telemetry

Add OpenTelemetry tracing to Laravel to measure performance and follow requests across dispatched jobs and services. Export traces to tools like Jaeger or Aspecto for end-to-end visibility and debugging. (Package still in development.)

View on GitHub
Deep Wiki
Context7

title: Installation & setup weight: 4

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 [
    /*
     * This value will be sent along with your trace.
     *
     * When set to `null`, the app name will be used
     */
    'default_trace_name' => null,

    /*
     * A driver is responsible for transmitting any measurements.
     */
    'drivers' => [
        Spatie\OpenTelemetry\Drivers\HttpDriver::class => [
            'url' => 'http://localhost:9411/api/v2/spans',
        ],
    ],

    /*
     * This class determines if your measurements should actually be sent
     * to the reporting drivers.
     */
    'sampler' => Spatie\OpenTelemetry\Support\Samplers\AlwaysSampler::class,

    /*
     * Tags can be added to any measurement. These classes will determine the
     * values of the tags when a new trace starts.
     */
    'trace_tag_providers' => [
        \Spatie\OpenTelemetry\Support\TagProviders\DefaultTagsProvider::class,
    ],

    /*
     * Tags can be added to any measurement. These classes will determine the
     * values of the tags when a new span starts.
     */
    'span_tag_providers' => [

    ],

    'queue' => [
        /*
         * When enabled, any measurements (spans) you make in a queued job that implements
         * `TraceAware` will automatically belong to the same trace that was
         * started in the process that dispatched the job.
         */
        'make_queue_trace_aware' => true,

        /*
         * When this is set to `false`, only jobs the implement
         * `TraceAware` will be trace aware.
         */
        'all_jobs_are_trace_aware_by_default' => true,

        /*
         *  When set to `true` all jobs will
         *  automatically start a span.
         */
        'all_jobs_auto_start_a_span' => true,

        /*
         * These jobs will be trace aware even if they don't
         * implement the `TraceAware` interface.
         */
        'trace_aware_jobs' => [

        ],

        /*
         * These jobs will never trace aware, regardless of `all_jobs_are_trace_aware_by_default`.
         */
        'not_trace_aware_jobs' => [

        ],
    ],

    /*
     * These actions can be overridden to have fine-grained control over how
     * the package performs certain tasks.
     *
     * In most cases, you should use the default values.
     */
    'actions' => [
        'make_queue_trace_aware' => Spatie\OpenTelemetry\Actions\MakeQueueTraceAwareAction::class,
    ],

    /*
     * This class determines how the package measures time.
     */
    'stopwatch' => Spatie\OpenTelemetry\Support\Stopwatch::class,

    /*
     * This class generates IDs for traces and spans.
     */
    '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

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport