Can PHP elastic agent send custom message to APM service asynchronously?

I got 2 questions that confused me

  1. I wonder if in the latest version of PHP apm agent, I can send custom message to APM server. like captureError, setContext which is nodeJS APM agent able to do

  2. In some case, there is a huge a mount of request comes into my app server, and for each reqesut/transaction which hit my endpoint, I also want to attach some metadata in it, so the apm agents can sends it to the apm server. I wonder if adding elastic_apm.async=true in the php.ini file can actully achieve the async mode of sending transaciton detail to apm server since I think the default set up is blocking (Correct me if I am wrong) which could have a chance to block my main business logic while sending data to apm server.

Thanks

Hi @JasonREC

Regarding question #1 - the answer is yes, you can use PHP Agent's public API.

Regarding question #2 - when running in the context of a web service PHP Agent sends data to APM Server in the background thus not blocking the application. There is indeed a past limitation (that we are working to lift) - when running in the context of CLI application PHP Agent by default sends data to APM Server synchronously (and as a consequence blocking the application). It's possible to override that default by explicitly setting async_backend_comm configuration option to true (by using elastic_apm.async_backend_comm in php.ini or ELASTIC_APM_ASYNC_BACKEND_COMM environment variable).

@Sergey_Kleyman Thank you very much! very helpful

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.