when I import ElasticApm class with use Elastic\Apm\ElasticApm I'm getting
Class 'Elastic\Apm\ElasticApm' not found
This is in production server.. I've restarted server and run the install process several times, but I was not able to fix it yet, so anything can be helpful
Please provide us a full output from phpinfo(). It might be html, pdf or screenshoots. Please keep in mind that it may contain sensitive data, like session data, keys, passwords, environment variables. Please remove this kind of data before publishing it.
How you installed agent, from package or manually compiled? Mannually
Did you verified that path specified in php.ini setting elastic_apm.bootstrap_php_part_file is correct and point to existing agent bootstrap file? Yes it is pointing to an existing path
Please provide us a full output from phpinfo(). It might be html, pdf or screenshoots. Please keep in mind that it may contain sensitive data, like session data, keys, passwords, environment variables. Please remove this kind of data before publishing it. Attached
Could you please attach agent logs? Here is a documentation how to enable logging Configuration | APM PHP Agent Reference [1.x] | Elastic. I suggest to set log level to TRACE. Depending on preferred output mode it can be one of following: Enabled
This is my entire php.ini configuration about elastic-apm:
Adding to this, I tried to force Laravel to find ElasticApm compiled classes, so I copied it to laravel folder, renaming namespace to make it be found.
Actually it dit found classes after this, but the transactions data was not complete,
it just register the name of transaction:
(production)
While in my container it shows every request:
(development) - I want that in production it logs as much as this
I'm not sure how to answer this one
I thought about checking if /opt-apm-agent-php/ path is accessible from PHP.
If open_basedir is configured in php.ini to some other location then PHP will not be able to access agent files.
Could you attach content of /opt/apm-agent-php/apm-agent-log.txt log file when you was trying to reproduce bug from first post?
Please add this line to php.ini - it was my mistake, I forgot about it: elastic_apm.log_level_file=TRACE
If you noticed, I'm getting the ElasticApm class from App\Elastic\Apm, not from Elastic\Apm as documentation says.. thats because I've copied the classes and changed namespace to force my app in prod to find the files..
At first I thought that was the reason for incomplete data, but I did the same in dev and worked nicely..
The platform I'm using in prod is Plesk and yes, I've checked all the configs I could use to make it work (php.ini, environment variables), but did not make it collect HTTP data
I'm not a fan of long replies, but this is the only place I found some help, thanks @Pawel_Filipczak
I don't have much experience with Plesk. I think you should get any agent related logs from container output.
Anyway, please take a look into phpinfo ouput. It states that you have open_basedir option enabled which points to /var/www/vhosts/udv.org.br/ and you have agent deployed into /opt/apm-agent-php.
I posted a link to official php documentation about open_basedir. If this feature is enabled PHP is unable to access files outside /var/www/vhosts/udv.org.br/ filesystem node. It can only go deeper.
That is why agent started to operate if you copied files into you application path, beacuse it is inside a fs node /var/www/vhosts/udv.org.br/ and because of auto-loading you got additional namespace node App\
To solve the issue you should modify open_basedir ini entry and add :/opt/apm-agent-php/ at the end.
Regarding differences between dev and prod. In my opinion there are differences in deployment. Try to fetch phpinfo from both and compare it (take a look at open_basedir).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.