Skip to content

BLACKFIRE🔗

Blackfire helps developers profile, test, debug, and optimize performance of their applications.

References:

  • Installing: https://blackfire.io/docs/up-and-running/installation
  • Profiling in browser: https://blackfire.io/docs/cookbooks/profiling-http-via-browser

Blackfire signup & credentials🔗

  • https://blackfire.io/signup --> Login with your Google or Github account and complete your registration
  • https://blackfire.io/docs/up-and-running/installation : when logged in, your credentials are available in the example CLI commands displayed:
1
sudo blackfire-agent --register --server-id=23f722f8-45e2-494e-XXXX-XXXXXXX --server-token=2cc54503db6e24407c6524XXXX...
1
blackfire config --client-id=2a18b73f-e6dc-4f3c-XXXX-XXXXXXXXX --client-token=2eaeca5f6a956cdf636cc62eXXXX....

You can also access your credentials through your Blackfire account : https://blackfire.io/my/settings/credentials (Or menu Account/My Settings/Credentials)

Provisioning (Ansible)🔗

Within your PHP project, copy file ansible/group_vars/app_local.yml.sample and adjust its content to your configuration:

1
cp ansible/group_vars/app_local.yml.sample ansible/group_vars/app_local.yml
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
  #######
  # Apt #
  #######

  apt_repositories:
    - blackfire

  ###################
  # Php - Blackfire #
  ###################

  php_blackfire: true

  php_blackfire_agent_config:
    - server-id:    23f722f8-45e2-494e-XXXX-XXXXXXX
    - server-token: 2cc54503db6e24407c6524XXXX...

  php_blackfire_client_config:
    - client-id:    2a18b73f-e6dc-4f3c-XXXX-XXXXXXXXX
    - client-token: 2eaeca5f6a956cdf636cc62eXXXX....

Run provisioning (outside VM):

1
ANSIBLE_TAGS=manala_apt,manala_php make provision

Check in your VM that Blackfire agent is running:

1
sudo service blackfire-agent status

Chrome extension & Profiling🔗

Download Chrome extension:

https://chrome.google.com/webstore/detail/blackfire-profiler/miefikpgahefdbcgoiicnmpbeeomffld

Profiling : https://blackfire.io/docs/cookbooks/profiling-http-via-browser

Tip

Each request you profile is available in your Blackfire Dashboard : https://blackfire.io/my/profiles (My profiles)

Profiling Ajax requests🔗

  • Open the Chrome inspector
  • Go to the "Network" tab
  • Trigger your Ajax request
  • In the Network tab, right click on your Ajax request and "copy as cURL" (see screenshot hereafter)
  • Execute the following command in your VM : blackfire curl <copied-cURL>

Timestamps🔗

  • Last update : June 2020
  • Blackfire version (blackfire version) : 1.36.0
  • Chrome extension (Profiler) version : 1.23.3

Last update: December 20, 2024