github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/docs/content/users/debugging-profiling/blackfire-profiling.md (about) 1 # Blackfire Profiling 2 3 DDEV has built-in [Blackfire](https://www.blackfire.io/) integration. 4 5 ## Basic Blackfire Usage (Using Browser Plugin) 6 7 1. Create a [Blackfire](https://www.blackfire.io/) account. (Free Blackfire accounts are no longer available; see [Blackfire pricing](https://www.blackfire.io/pricing/).) 8 2. Install the Chrome or Firefox [browser plugin](https://blackfire.io/docs/profiling-cookbooks/profiling-http-via-browser). 9 3. From Blackfire’s control panel, get the Server ID, Server Token, Client ID, and Client Token from your Account → Credentials or environment. 10 4. 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 using `ddev config --web-environment-add`. (It may be easier to manually edit the relevant config file, `.ddev/config.yaml` or `~/.ddev/global_config.yaml`.) 11 5. [`ddev start`](../usage/commands.md#start). 12 6. [`ddev blackfire on`](../usage/commands.md#blackfire) to enable, `ddev blackfire off` to disable, `ddev blackfire status` to see status. 13 7. With Blackfire enabled, you can use the [browser extension](https://blackfire.io/docs/profiling-cookbooks/profiling-http-via-browser). 14 15 ## Profiling with the Blackfire CLI 16 17 The Blackfire CLI is built into the web container, so you don’t need to install it yourself. 18 19 1. Add the `BLACKFIRE_SERVER_ID`, `BLACKFIRE_SERVER_TOKEN`, `BLACKFIRE_CLIENT_ID`, and `BLACKFIRE_CLIENT_TOKEN` environment variables to `~/.ddev/global_config.yaml` via the `web_environment` key: 20 21 ```yaml 22 web_environment: 23 - OTHER_ENV=something 24 - BLACKFIRE_SERVER_ID=dde5f66d-xxxxxx 25 - BLACKFIRE_SERVER_TOKEN=09b0ec-xxxxx 26 - BLACKFIRE_CLIENT_ID=f5e88b7e-xxxxx 27 - BLACKFIRE_CLIENT_TOKEN=00cee15-xxxxx1 28 ``` 29 30 You can also do this with `ddev config global --web-environment-add="BLACKFIRE_SERVER_ID=<id>,BLACKFIRE_SERVER_TOKEN=<token>,BLACKFIRE_CLIENT_ID=<id>,BLACKFIRE_CLIENT_TOKEN=<token>"`, but any existing environment variables will be deleted. 31 32 2. [`ddev start`](../usage/commands.md#start). 33 3. `ddev blackfire on`. 34 4. Click the “Blackfire” browser extension to profile. 35 36 ## Examples of Using the Blackfire CLI 37 38 * `ddev blackfire on` and `ddev blackfire off` 39 * [`ddev exec blackfire curl https://<yoursite>.ddev.site`](../usage/commands.md#exec) 40 * `ddev exec blackfire drush st` 41 * `ddev exec blackfire curl https://<yoursite>.ddev.site` 42 * [`ddev ssh`](../usage/commands.md#ssh) and use the Blackfire CLI as described in [Profiling HTTP Requests with the CLI](https://blackfire.io/docs/profiling-cookbooks/profiling-http-via-cli).