humanmade / aws-xray

HM Platform AWS X-Ray Integration
23 stars 4 forks source link

X-Ray is Disabled? #87

Closed orrinsheppard closed 6 months ago

orrinsheppard commented 2 years ago

Hi everyone! Apologies if I am missing something obvious here.

I am trying to install this plugin on a Wordpress instance. I have download the plugin to wp-content/plugins, unzipped it and activated it on my WordPress Admin Dashboard. Prior to this, I installed xhprof and confirmed it was initialized via 'php -m' on the WordPress instance. I have also tried excimer.

The AWS X-Ray agent is running on the instance, but shows no data being received. I only see logs for the agent starting. I added some print statements, and determined the plugin is exiting early due to the event functions not being available (the if conditional in plugin.php). Have I set this up incorrectly? Any insight would be greatly appreciated here.

joehoyle commented 1 year ago

Hi @orrinsheppard ,

Sorry for the delayed response, and lack of documentation of setting this plugin up!

So, this plugin can be installed via Composer which would be the recommended route, but not required. The reason for the early check in "the if conditional in plugin.php" is to check that this "special" WordPress plugin has already been loaded early. Instead of this plugin loading when the rest of WordPress plugins are loaded, it's intended that you include it manually at the start of the WordPress bootstrap process, so it can capture all of the WordPress setup queries and time etc.

For example, in your wp-config.php you'd actually include this file: https://github.com/humanmade/aws-xray/blob/master/inc/namespace.php and call HM\Platform\XRay\bootstrap() immediately in that file, to start tracking the start of the Xray trace, etc.