Let's start from downloading phar
archive with Blackfire Player:
curl -OLsS https://get.blackfire.io/blackfire-player.phar
And execute scenario.bkf
file with api test scenario
php blackfire-player.phar run scenario.bkf -v
You have run your first test scenario!
You can build docker image with Blackfire Player with following command:
docker build -t blackfire-player docker/blackfire-player
And run test scenarios:
docker run -v `pwd`:/app blackfire-player run scenario.bkf -v
I've create a simple docker app, which counts Fibonacci Sequence (for no reason), and returns response same as previous api.
Let's run the app via:
docker-compose up -d
docker run --network=symfony_live_warsaw -v `pwd`:/app blackfire-player run scenario.bkf -v --endpoint=http://nginx/
To start profiling the performance of your app, you need to know your credentials. You can find it here: https://blackfire.io/my/settings/credentials To make your life easier, export it as a shell variables:
export BLACKFIRE_CLIENT_ID=<id>
export BLACKFIRE_CLIENT_TOKEN=<token>
export BLACKFIRE_SERVER_ID=<server-id>
export BLACKFIRE_SERVER_TOKEN=<server-token>
And recreate the containers:
docker-compose up -d
Now your app can be profiled with the Blackfire.
docker-compose exec blackfire blackfire --samples=3 curl http://nginx/products/prices
Blackfire Player groups results of performance measurements into builds for better readability. Environments are available only to Premium and Enterprise users. You can check your envs here: https://blackfire.io/my/environments.
Let's use the same scenario as previous. We have already configure Blackfire credentials, so you only need to pass environment ID to our test execution:
docker run --network=symfony_live_warsaw -v `pwd`:/app blackfire-player run scenario.bkf -v --endpoint=http://nginx/ --blackfire-env=<id>