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

Add executed filename and backtrace in metadata #61

Open
gianniszach opened this issue Dec 30, 2019 · 1 comment
Open

Add executed filename and backtrace in metadata #61

gianniszach opened this issue Dec 30, 2019 · 1 comment
Labels
enhancement New feature or request nice to have

Comments

@gianniszach
Copy link

The extension logs the function/method name, the timings and the arguments in the metadata, it would be great if you could add the filename that executed the function/method and a backtrace showing the filename of the original caller.

I've tried to add the filename by adding another variable in the scoutapm_stack_frame and using the zend_get_executed_filename() inside the record_observed_stack_frame() like this

SCOUTAPM_G(observed_stack_frames)[SCOUTAPM_G(observed_stack_frames_count)].function_filename = zend_get_executed_filename();

This seems to work alright, however, I can only see the filename executing the observed function.

In cases where for example I have a PDO database class file and my "main" file includes and uses the database file. In the "main" file I create my SQL query and I use the database class to run it. The current implementation shows the database class filename where I'd like to also see the filename of the original caller, hence the need of the backtrace.

I've tried to use the prev_execute_data of zend_execute_data to fetch the previous filename but I'm way out of my league, I don't know anything about PHP internals and the only thing I managed to create is a segfault :)

@asgrim asgrim added enhancement New feature or request nice to have labels Dec 31, 2019
@asgrim
Copy link
Collaborator

asgrim commented Dec 31, 2019

Thanks for the suggestion, we'll take a look and figure out what can be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request nice to have
Projects
None yet
Development

No branches or pull requests

2 participants