This add-on adds Open Telemetry for CakePHP projects. It is designed to integrate with tyler36/ddev-site-metrics. This is achieved by:
- installing opentelemetry PHP addon.
- configures system-level environmental variables
ddev add-on get tyler36/ddev-site-metrics-cakephp
ddev restartAfter 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"
- To disable all telemetry, update
.ddev/.env.weband restart DDEV.
OTEL_PHP_AUTOLOAD_ENABLED="false"
- To send traces to ddev-site-metrics, update
.ddev/.env.weband 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.
- Confirm PHP module is installed.
$ ddev php --ri opentelemetry
...
opentelemetry hooks => enabledContributed and maintained by @tyler36