Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] profiling ZTS builds #2070

Closed
sumerc opened this issue May 22, 2023 · 10 comments
Closed

[Feature] profiling ZTS builds #2070

sumerc opened this issue May 22, 2023 · 10 comments
Labels
feature-request profiling Relates to the Continuous Profiler

Comments

@sumerc
Copy link

sumerc commented May 22, 2023

Hi,

Is supporting zts builds something planned for the future, is there any issue for this? Sorry, if this is already discussed, but I can not seem to find an issue for that.

@morrisonlevi
Copy link
Collaborator

Which product are you asking for?

  • Appsec supports ZTS.
  • Tracing supports ZTS.
  • Profiling does not support ZTS and doesn't have an ETA.

@sumerc
Copy link
Author

sumerc commented May 22, 2023

It was for profiling. Thanks for the info!

What is the main reason behind the complexity?. Maybe we might think to work on it if we understand the underlying problem?

@morrisonlevi morrisonlevi changed the title [Feature] ZTS builds [Feature] profiling ZTS builds May 22, 2023
@morrisonlevi morrisonlevi added the profiling Relates to the Continuous Profiler label May 22, 2023
@morrisonlevi
Copy link
Collaborator

May I ask what you are using ZTS builds for? What libraries and such are you using?

Some of the complexity is that the PHP ABIs change for ZTS. The C macros that C extensions use don't always help since the profiler is primarily written in Rust. It's possible to support, I think, and is more of a matter of priority. Understanding what you are using ZTS builds for can help us understand the priority.

@sumerc
Copy link
Author

sumerc commented May 24, 2023

We are thinking of integrating continuous profiling for https://docs.platform.sh/languages/php.html. And it currently uses ZTS.

@piotrekkr
Copy link

I wanted to use frankenphp as replacement for php-fpm+nginx. It is a ZTS build. Installer does not allow profiling. I liked how profiling worked with php-fpm and would be nice if it was available with ZTS.

$ docker build . -f Dockerfile-frankenphp                                            
...
------                                                                                                                                                                                                                                                                                                                      
 > [stage-0 4/4] RUN php /datadog-setup.php --php-bin=all --enable-profiling:                                                                                                                                                                                                                                               
0.536 Searching for available php binaries, this operation might take a while.                                                                                                                                                                                                                                              
0.666 Downloading installable archive from https://github.com/DataDog/dd-trace-php/releases/download/0.96.0/dd-library-php-0.96.0-x86_64-linux-gnu.tar.gz.                                                                                                                                                                  
0.666 This operation might take a while.                                                                                                                                                                                                                                                                                    
1.620 ...................                                                                                                                                                                                                                                                                                                   
8.662 Download completed
8.662 
12.51 Installed required source files to '/opt/datadog/dd-library/0.96.0'
12.57 Installing to binary: php (/usr/local/bin/php)
12.66 Copied '/tmp/dd-install/dd-library-php/trace/ext/20230831/ddtrace-zts.so' to '/usr/local/lib/php/extensions/no-debug-zts-20230831/ddtrace.so'
12.66 Copied '/tmp/dd-install/dd-library-php/appsec/ext/20230831/ddappsec-zts.so' to '/usr/local/lib/php/extensions/no-debug-zts-20230831/ddappsec.so'
12.66 Created INI file '/usr/local/etc/php/conf.d/98-ddtrace.ini'
12.66 ERROR: Option --enable-profiling was provided, but it is not supported on this PHP build or version.
12.66 
------
Dockerfile-frankenphp:6
--------------------
   4 |     ADD https://github.com/DataDog/dd-trace-php/releases/download/0.96.0/datadog-setup.php /datadog-setup.php
   5 |     
   6 | >>> RUN php /datadog-setup.php --php-bin=all --enable-profiling
   7 |     
--------------------
ERROR: failed to solve: process "/bin/bash -o pipefail -c php /datadog-setup.php --php-bin=all --enable-profiling" did not complete successfully: exit code: 1

@realFlowControl
Copy link
Member

Hey @sumerc / @piotrekkr,

I just wanted to let you know that I'll working on bringing ZTS support to the profiler. A first PR to make it compile is already there, more to follow. I'll keep you posted.

Kind regards
Florian

@sumerc
Copy link
Author

sumerc commented Jan 15, 2024

Thanks for the update!

@piotrekkr
Copy link

piotrekkr commented Jan 15, 2024

Cool. Can't wait 👍

@realFlowControl
Copy link
Member

realFlowControl commented Feb 20, 2024

Hey @sumerc / @piotrekkr,

we just released 0.98.0 which brings ZTS (more or less as private beta) support for CPU and Wall time profiling including timeline. I have also tested this with FrankenPHP!
I have not yet tested Exception Profiling, but it seems to work, I'll make this sure for a later release and I am currently working on making allocation profiling thread safe in #2506, in the mean time allocation profiling is intentionally disabled on ZTS PHP as it would crash. There will also be some work done by me to better support FrankenPHP's worker mode in #2523.

Let me know how this works for you!

Kind regards
Florian

@realFlowControl
Copy link
Member

Hey there 👋

0.99 just got released and brings ZTS support for exception, as well as allocation profiling and FrankenPHP support (including worker mode) 🎉

The tracer also added support for FrankenPHP into this release.

Thanks everyone for your patience 🙏 and in case you find anything, please open a Github Issue or reach out to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request profiling Relates to the Continuous Profiler
Projects
None yet
Development

No branches or pull requests

4 participants