tavsec/laravel-opentelemetry

Laravel package for OpenTelemetry implementation

0.2.2 2023-05-22 14:05 UTC

This package is auto-updated.

Last update: 2024-10-31 00:26:41 UTC


README

This package provides OTEL exporter for Laravel applications.

Usage

Middleware

Middleware will track requests and export them to OTEL. Add OpenTelemetryMiddleware to app/Http/Kernel.php file, at the end of $middleware array.

protected $middleware = [
    // ...
    OpenTelemetryMiddleware::class
];

Additional metrics/spans

        $tracing = (new OpenTelemetry)->startSpan("<SPAN-NAME>", [
            "att1" => "foo",
            "att2" => "bar"
        ]);
        
        sleep(200);
        
        $tracing->endSpan();

Current reports

  • Cache hit/miss
  • Request parameters
  • Eloquent queries