blackfireio / php-sdk

The Blackfire PHP SDK
https://blackfire.io
MIT License
150 stars 22 forks source link

Probe and agent work, but profiling result is empty (only "main()") #64

Closed ChristopheZOL closed 2 years ago

ChristopheZOL commented 2 years ago

Hi everyone,

I'm not sure if it's the correct place to ask for this (or stackoverflow). I have used blackfire multiple times in different situations over the past years, it's an amazing tool, but I fail to make it works under azure default php docker container. Here I use the blackfire cli, but if I use the composer package to start the profiler for a specific part of the code (whatever it is), I get the exact same empty result.

XXXX@XXXXXXXXX:/home# blackfire curl http://127.0.0.1:8080
Profiling: [########################################] 100%  
Blackfire cURL completed
Graph                 https://blackfire.io/profiles/3c9c8e81-8f79-4c9d-8773-d3f18cade96d/graph
No tests!             Create some now https://blackfire.io/docs/testing-cookbooks/tests
No recommendations

Wall Time       0µs
I/O Wait        0µs
CPU Time        0µs
Memory           0B
Network         n/a     n/a     n/a
SQL             n/a     n/a

Then on graph, I have an "empty" result, with only main() function Selection_012

For a bit of context : it's a symfony application, php 8.0, on the default php docker container from azure (ubuntu 18.04)

The documentation says blackfire is not compatible with xdebug and pcov, which I don't use (checked with php -i)

I'm not sure it's a problem with the sdk itself, but at this point, I have no other idea :cry: If you have any clue, or encountered a similar situation, I'm really interested in any advice !

iamluc commented 2 years ago

Hi @ChristopheZOL ,

I believe the Blackfire PHP extension is missing on your setup. The SDK is not enough (and even not required for classic use-cases)

Please contact the Blackfire support if you need help.

ChristopheZOL commented 2 years ago

Update on the subject : you were absolutly right about the focus on extension problem : php -i correctly show the extension loaded, but phpinfo(); do not. The problem was related to how docker container from azure works, php-fpm process is started as main process and cannot be reloaded without shutting down the container (and as a result restart without blackfire).

The solution was to add blackfire installation before starting php-fpm by setting start up command, as used in the official Dockerfile : https://github.com/Azure-App-Service/ImageBuilder/blob/master/GenerateDockerFiles/php/nginx/init_container.sh

Hope it helps someone who will find this issue in the future