Blackfire integration

This topic provides information for setting up your Blackfire credentials and integration.

For full details on integrations, also review Blackfire’s complete Magento Commerce (Cloud) guide.

Get your Blackfire credentials

The account owner has access to the Blackfire credentials for your project. Contact the account owner for more information.

Enable the Blackfire integration

We recommend you enable the Blackfire integration in an environment (that is, branch). You can optionally merge the environment with its parent after you know it’s working.

To enable Blackfire:

  1. Log in to the machine on which your SSH keys are stored.
  2. Log in to your Magento Enterprise Cloud Edition project.

    magento-cloud login
  3. List projects:

    magento-cloud project:list
  4. List environments in the project:

    magento-cloud environment:list -p <project ID>
  5. See what branch you’re currently in, if any.

    git branch
  6. If necessary, check out an existing branch:

    magento-cloud environment:checkout <environment ID>

    You can also create a new branch using the magento-cloud environment:branch command.

  7. Back up the environment using a snapshot:

    magento-cloud snapshot:create -e <environment ID>
  8. Use a text editor to open <project root dir>/
  9. Add the following to the extensions block under runtime:

        - name: blackfire
             server_id: "<blackfire Server ID>"
             server_token: "<blackfire Server token>"

    Change <blackfire Server ID> and <blackfire Server token> to the values from your Blackfire account.

    For example:

        - mcrypt
        - redis
        - xsl
        - json
        - name: blackfire
             server_id: "<blackfire Server ID>"
             server_token: "<blackfire Server token>"
  10. Save your changes to and exit the text editor.
  11. Add, commit, and push your changes to the environment:

    git add -A
    git commit -m "<message>"
    git push origin

    If errors display during deployment, open and check the syntax. Check indentation and spelling and try again.

Verify it’s working

To verify Blackfire works, you can SSH to the environment and run a command as follows:

  1. Log in to the Web UI.
  2. In the right pane, click the name of your environment.
  3. Hover the mouse pointer over Access site.
  4. Copy the SSH access URL to the clipboard as the following figure shows.

    Find the SSH URL for the environment

  5. Enter that command in your terminal window to log in using SSH.
  6. Enter the following command:

    php --ri blackfire

    A sample result follows:

    Blackfire => enabled
    Blackfire => 1.10.3
    Timing measurement => cgt
    Num of CPU => 8
    Profiling heap memory => 0 Kb
    Main instance trigger mode => HTTP header triggered
    Main instance => enabled
    Main instance info
    Output stream => file
    Signature validated => no
    EnvId validated => no
    Fully decoded => no
    Directive => Local Value => Master Value
    blackfire.agent_socket => tcp:// => tcp://
    blackfire.agent_timeout => 10 => 10
    blackfire.env_id => no value => no value
    blackfire.env_token => no value => no value
    blackfire.log_level => 1 => 1
    blackfire.log_file => no value => no value

Profile your site

To start profiling your site using Blackfire:

  1. Install the Companion browser plug-in for your browser.

    For example, to install the Chrome Companion, see documentation.

  2. Use the Web UI to find the Web access URL for your environment as the following figure shows:

    Find your environment's URL

  3. Go to your site using Chrome.
  4. In the upper right corner of the Chrome window, click Start Blackfire.
  5. Follow the prompts on your screen to set up a comparison, then click Profile! as the following figure shows.

    Start profiling

Using Blackfire is beyond the scope of this guide. For more information, see one of the following resources: