apm-agent-php
apm-agent-php copied to clipboard
Add support for automatic instrumentation of `{mysql,pg}_query`
Is your feature request related to a problem? Please describe.
While adding Elastic APM to one of our stacks, we discovered that PDO is supported however the MySQL/Postgres *_query
style functions are not automatically instrumented. Luckily we have a single entrypoint class we can use however I'm unsure how many others will be in the same boat.
Describe the solution you'd like
Out of the box, mysql_query
and pg_query
are automatically instrumented the same way PDO is.
Describe alternatives you've considered
You can workaround this issue by manually instrumenting each call site or using a single chokepoint class however neither are ideal when you could push this work to the agent to instrument on your behalf.
Additional context
This is by no means a recommendation for people to use either of these functions (we have an older codebase with custom PDO layered on top) but should be an option to avoid manually doing the work.
this will be huge advantage to capture purephp and some of the older framework code such as CI 3.x+
@AshanCG if it's still relevant please open a separate issue for the technologies that you mentioned.
@jacobbednarz We already released support for MySQLi extension - will it address the part of your request for mysql_query
?
hey @SergeyKleyman 👋 since opening the issue back in 2021, we took a different route for our APM needs so this isn't something I can speak for too much today.
however, the question can be possibly be concretely answered by what language support is offered by the APM product. older _query
procedural style functions are only supported in older versions of PHP (< 8) whereas MySQLi is supported from PHP 5 through to trunk -- but it is a different API between the two bindings.
@jacobbednarz Thank you for the clarification. We are going to close it for now. Please let us know if it's relevant.