Blackfire.io Profiling¶
DDEV-Local has built-in blackfire.io integration.
Basic Blackfire Usage (Using Browser Plugin)¶
- Create an account on blackfire.io
- Install the Chrome or Firefox browser plugin.
- Get the Server ID, Server Token, Client ID, and Client Token from your Account->Credentials or environment on blackfire.io.
- Configure ddev with the credentials,
ddev config global --web-environment-add="BLACKFIRE_SERVER_ID=<id>,BLACKFIRE_SERVER_TOKEN=<token>,BLACKFIRE_CLIENT_ID=<id>,BLACKFIRE_CLIENT_TOKEN=<token>". It's easiest to do this globally, but you can do the same thing at the project-level usingddev config --web-environment-add. (It may be easier to manually edit the relevant config file,.ddev/config.yamlor~/.ddev/global_config.yaml.) ddev startddev blackfire onto enable,ddev blackfire offto disable,ddev blackfire statusto see status.- With Blackfire enabled, you can use the browser extension.
Profiling with the Blackfire CLI¶
The Blackfire CLI is built into the web container, so no installation needs to take place.
-
Add the BLACKFIRE_SERVER_ID, BLACKFIRE_SERVER_TOKEN, BLACKFIRE_CLIENT_ID, and BLACKFIRE_CLIENT_TOKEN environment variables to your ~/.ddev/global_config.yaml. You can do this by adding to the
web_environmentkey:
It can also be done with ddev config global --web-environment-add="BLACKFIRE_SERVER_ID=<id>,BLACKFIRE_SERVER_TOKEN=<token>,BLACKFIRE_CLIENT_ID=<id>,BLACKFIRE_CLIENT_TOKEN=<token>", but if there are already environment variables there they will be deleted. 2. ddev start 3. ddev blackfire on 4. Click the "blackfire" browser extension to profile
Examples of using the Blackfire CLI¶
ddev blackfire onandddev blackfire offddev exec blackfire curl https://<yoursite>.ddev.siteddev exec blackfire drush stddev exec blackfire curl https://<yoursite>.ddev.siteddev sshand then use the Blackfire CLI as described in Profiling HTTP Requests with the CLI.
Last update: July 7, 2022