Raised: $0
0% of monthly goal Help us cross the finish line!
Goal: $12,000
Raised: $0 Goal: $12,000
0% of monthly goal Help us cross the finish line!
Sponsor DDEV

add-on registry tests last commit release

DDEV Site Metrics Laravel

Overview

This add-on adds Open Telemetry for Laravel projects. It is designed to integrate with tyler36/ddev-site-metrics. This is achieved by:

Installation

ddev add-on get tyler36/ddev-site-metrics-laravel
ddev restart

After installation, make sure to commit the .ddev directory to version control.

Usage

Traces are automatically injected into PHP calls. This is configured via .ddev/.env.web.

OTEL_PHP_AUTOLOAD_ENABLED="true"
OTEL_SERVICE_NAME="laravel"
OTEL_METRIC_EXPORTER="none"
OTEL_LOGS_EXPORTER="none"
OTEL_TRACES_EXPORTER="console"
OTEL_PHP_AUTOLOAD_ENABLED="false"
OTEL_TRACES_EXPORTER="otlp"
OTEL_EXPORTER_OTLP_ENDPOINT=http://alloy:4318

Configuration

Environmental Variables

Environmental variables need to be set early in the process. This addon uses .ddev/.env.web to set them for the container; variables set in ${DDEV_PROJECT_ROOT}/.env are read too late and do not work. Additionally, we set them in the web container to prevent leakage into other containers.

Debugging

$ ddev php --ri opentelemetry
...
opentelemetry hooks => enabled

Credits

Contributed and maintained by @tyler36