This is a demo project for 3 ways you can integrate Prometheus / OpenMetrics in your Symfony application. The app has 3 endpoints available for monitoring:
- http://localhost/legacy/metrics - using sql
- http://localhost:3903/metrics - via mtail
- http://localhost/prometheus/metrics - using bundle
The app has 2 tables: bank accounts and users and include a prometheus config.
Prometheus is available on http://localhost:9090
Application configuration is stored in .env
file.
Run cp .env.dist .env
to apply the default configuration for local installations.
If you have nginx or apache installed and using 80 port on host system you can either stop them before proceeding or
reconfigure Docker to use another port by changing value of EXTERNAL_HTTP_PORT
in .env
file.
You can change application environment to dev
of prod
by changing APP_ENV
variable in .env
file.
DB name and credentials could by reconfigured by changing variables with POSTGRES
prefix in .env
file. It is
recommended to restart containers after changing these values (new database will be automatically created on containers
start).
On Linux:
docker-compose up -d
docker-compose exec php bin/console doctrine:migrations:migrate
docker-compose exec php bin/console doctrine:fixtures:load
Just go to http://localhost/legacy/metrics
Creating a user:
curl -X POST http://localhost/user -d name=testusername