Closed roborourke closed 4 years ago
Hmm wondering how you triggered this, as we shouldn't be loading X-Ray on the CLI at all?
I think it needs more consideration if we want to add it in that context, as really X-Ray is built around the concept of HTTP requests. We can certainly map WP CLI to it, but we'll want to decide how to track things like the running command, execution status etc.
See also #8.
Soz, for clarity it's currently triggered when you run PHPUnit, at least via composer dev-tools phpunit
in Altis. I believe it occurs during the install process that the WP PHPUnit bootstrapping spawns.
It's fine to just avoid loading XRay if it's not really suitable for CLI purposes but perhaps there's other contexts we need to consider. This might well be best fixed elsewhere eg. in Altis itself in that case.
Ah yes, for now atleast, we should modify Altis Cloud to not load it under php_sapi_name() === 'cli'
not just WP_CLI
.
Cheers, will PR that now
The function
get_in_progress_trace()
assumes that XRay is running in an HTTP context. You can't always rely on things likeHTTP_HOST
being shimmed in CLI contexts so it should check for the context it's in before adding HTTP related data to the trace.We'll also need to check anywhere that outputs this data and ensure it can handle the lack of it.