php-8-tracing-hooks
Low-overhead tracing hooks for PHP 8
Low-overhead tracing hooks for PHP 8
Low-overhead tracing hooks for PHP 8
Hello,
Apologies if me dropping in and drafting this issue seems weird. I am a big fan of how tracing can help with managing an application in production and would like to help out with adding first-class tracing hooks to PHP.
In the past I've used the OpenCensus extension to export tracing data to a managed service. This extension leaves a lot to be desired, but one thing it got right in my opinion - ability to declare instrumented function at runtime.
For example, one can declare a traced function and add attributes to it in PHP:
opencensus_trace_function('curl_exec', fn ($resource) => ['attributes' => ['url' => curl_getinfo($resource, CURLINFO_EFFECTIVE_URL)]]);
This is very powerful, in my opinion. If this functionality was available in PHP core, many open source frameworks and libraries could provide automatic instrumentation of their code. Think Symfony automatically instrumenting cache calls or Doctrine - DB calls.
I've researched php-src
to find an appropriate place to call code which would instrument selected functions - both internal and user-land.
Since I am very new to php-src
and have no C coding experience, so far I haven't gotten anywhere.
I've looked into zend_execute_ex
and zend_execute_internal
and tried to find where they are called. I've also stumbled upon ZEND_VM_HOT_HANDLER(130, ZEND_DO_UCALL, ANY, ANY, SPEC(RETVAL))
.
Could you point me in the right direction: where would it make sense to call code that instruments a function? Or is the only way to override function pointers? Is declaring instrumented function runtime even a viable feature?
Thanks for your time and everything you do for the PHP community!
split up engine improvements in two parts
additional functionality besides zend_execute_ex for instrumenting ALL function calls
instrument specific function calls
int should_instrument(zend_function *function) {
funciton->flags |= ZEND_INSTURMENTED;
}
Own Stack vs VM Stack:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.