This add-on adds Open Telemetry for Laravel projects. It is designed to integrate with tyler36/ddev-site-metrics. This is achieved by:
ddev add-on get tyler36/ddev-site-metrics-laravel
ddev restart
After installation, make sure to commit the .ddev directory to version control.
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"
.ddev/.env.web and restart DDEV.OTEL_PHP_AUTOLOAD_ENABLED="false"
.ddev/.env.web and restart DDEV.OTEL_TRACES_EXPORTER="otlp"
OTEL_EXPORTER_OTLP_ENDPOINT=http://alloy:4318
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.
$ ddev php --ri opentelemetry
...
opentelemetry hooks => enabled
Contributed and maintained by @tyler36