humanmade / aws-xray

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

Usage with local docker environment #101

Closed pdewouters closed 1 month ago

pdewouters commented 1 month ago

Hi, I tried this with a local docker install, with the excimer extension, but the AWS Xray menu option does not show up in the QM panel. Any idea what could be missing? Screenshot 2024-07-19 at 09 21 16

QM Version 3.16.3 AWS Xray Version 1.2.3 PHP Version 8.2.21

mikelittle commented 1 month ago

Hi Paul, I had a similar problem. I seem to recall I had to stick this code in an early loading mu-plugin

$has_profiler = class_exists( 'ExcimerProfiler' ) || function_exists( 'xhprof_sample_enable' );
if ( $has_profiler ) {
    require_once WPMU_PLUGIN_DIR . '/aws-xray/inc/namespace.php';
    require_once WPMU_PLUGIN_DIR . '/aws-xray/plugin.php';
    \HM\Platform\XRay\bootstrap();
    \HM\Platform\XRay\Query_Monitor\bootstrap();
}

Also, did you install it in the vendor folder or mu-plugins? The QM panel requires the flamergraph.js file. Unless your docker environment is set up to serve files from the vendor folder, it can't load it. You'll see the data but no flame graph. I moved it to mu-plugins to get that to work. (Mostly because I didn't want to/couldn't be bothered serving files from the vendor folder.

pdewouters commented 1 month ago

Thanks @mikelittle - after adding AWS Xray as an mu-plugin, I actually ran into a fatal error: "undefined function socket_create" - which means I also have to install the sockets extension which isn't available by default with the docker WordPress image

RUN docker-php-ext-install sockets

Now I get the AWS Xray tab in QM :)

[Edited to remove invalid issue]

All good now, thanks for your help