This add-on adds Open Telemetry for CakePHP projects. It is designed to integrate with tyler36/ddev-site-metrics. This is achieved by:
ddev add-on get tyler36/ddev-site-metrics-cakephp
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="cakephp"
OTEL_METRIC_EXPORTER="none"
OTEL_LOGS_EXPORTER="console"
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://grafana-alloy:4317
Environmental variables need to be set early in the process.
This addon uses .ddev/.env.web to set them for the container.
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