This repository is inspired by https://github.com/open-telemetry/opentelemetry-php/blob/main/docs/laravel-quickstart.md It goes a bit deeper in defining spans and usage of OpenTelemetry tools in controllers
Create service account with permissions for writing logs and traces and create credentails for it. Download .json credentials
and place them in storage/credentials.json
. Check the .example.env for Google project environment variables.
If tracing and logging does not work the biggest chance is that credentials and permissions are not correctly set up. Currently hard to debug because tracer is instantiated outside Laravel scope. This implementation should be moved to Laravel lifecycle if possible.
cd docker
cp .env.example .env
// replace UID and USER_NAME in .env file with ones from your system
// UID of current user can be found by runnning following commant
id -u
docker-compose up -d
// System is up and running
docker-compose run --rm composer install
For better experience edit hosts
file and add
127.0.0.1 otel.test
Now navigate to http://otel.test:8083/
index.php
app/Http/Controllers/HelloController.php
http://localhost:9411/ Zipkin
http://localhost:16686/ Jaeger