Download the PHP package laraotel/opentelemetry-laravel without Composer
On this page you can find all versions of the php package laraotel/opentelemetry-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laraotel/opentelemetry-laravel
More information about laraotel/opentelemetry-laravel
Files in laraotel/opentelemetry-laravel
Package opentelemetry-laravel
Short Description This package provides a simple way to use Telemetry From OpenTelemetry Otel to your Laravel application to Measure performance across jobs and services.
License MIT
Informations about the package opentelemetry-laravel
LaraOTel OpenTelemetry Laravel Package
This package provides a simple way to use Telemetry From OpenTelemetry OTel into your Laravel application to Measure performance across jobs and services, database queries, events etc..
Introduction
OpenTelemetry, or OTel for short, is an Observability tools designed to create and manage telemetry data such as traces, metrics and logs, to collect information on how your entire system is behaving.
You can easily measure performance of a Laravel powered system. It can transmit the results to a tracing tool like Jaeger, Zikpin Or you can export data into Console, Json, text etc..
Bundle Zikpin and Jaeger into your Application
To visualize traces exported from our application, we need to integrate open source tracing tools Zipkin and Jaeger into our setup using docker.
First, we create a docker-compose.yaml
file in the root of our project, with content as follows:
Next, we pull in Zipkin and Jaeger by running docker-compose up -d
.
We can confirm that Zipkin is up by navigating to http://localhost:9411/
on our browser. For Jaeger, navigating
to http://localhost:16686/
on our browser should display the Jaeger home page.
Installation
You can install the package via composer:
Important Note: The opentelemetry extension must be enabled on your machine.
Usage
Configuration
Publish the configuration file:
Update the environment variables
You can find them in configuration file: config/otel.php
.
Register the middleware
you can register the middleware in the app/Http/Kernel.php
:
In laravel 11 you can not register in the kernel.php the middlewares anymore. You can register your global middleware in bootstrap/app.php
or you can set the env variable OTEL_AUTO_TRACE_REQUESTS
to true
to enable it automatically.
Watchers
This package provides some watchers to help you trace your application:
LaraOTel\OpenTelemetryLaravel\Watchers\AuthenticateWatcher
to trace authentications.LaraOTel\OpenTelemetryLaravel\Watchers\CacheWatcher
to trace cache operations.LaraOTel\OpenTelemetryLaravel\Watchers\DatabaseQueryWatcher
to trace database queries.LaraOTel\OpenTelemetryLaravel\Watchers\QueueWatcher
to trace job execution.LaraOTel\OpenTelemetryLaravel\Watchers\RedisWatcher
to trace redis operations.LaraOTel\OpenTelemetryLaravel\Watchers\EventWatcher
to trace event opearations.LaraOTel\OpenTelemetryLaravel\Watchers\HttpClientWatcher
to trace http client requests.LaraOTel\OpenTelemetryLaravel\Watchers\LogWatcher
to trace log operations.
You can enable or disable them in the configuration file: config/otel.php
.
Custom span
You can create a custom span by using the LaraOTel\OpenTelemetryLaravel\Facades\Measure
facade:
or manually start and end a span:
and you can modify the span attributes by using a closure:
of course, you can get the span instance by using the Measure::span()
method:
Available Drivers
Available Logs Level
UML Diagram of the package design
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of opentelemetry-laravel with dependencies
open-telemetry/sdk Version *
open-telemetry/exporter-otlp Version *
ext-opentelemetry Version *
open-telemetry/opentelemetry-auto-laravel Version ^0.0.25