Can we set up a full-fledged Observability of the Laravel app running on Forge?

You can easily set up end-to-end observability for a Laravel application running on Forge using Middleware.

Steps to Follow:

  1. Install the Middleware agent according as per your configuration.
  2. Run the Laravel instrumentation script.
 curl -O https://install.middleware.io/apm/php/laravel-instrument.php
COMPOSER_ALLOW_SUPERUSER=1 php laravel-instrument.php install
  1. Logs and traces are enabled by default.
  2. To enable metrics, please follow the documentation provided here.
  3. Finally, before running the application, make sure to implement the following changes.

Set this in your environment variable and restart your app to start the instrumentation.

OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_SERVICE_NAME=your-service-name
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:9320

To correlate frontend traces with backend traces, add the following environment variable:

OTEL_PROPAGATORS=baggage,tracecontext,b3multi

Hurrah your observability setup is done.:partying_face: