Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blackfire: Add distributed profilling support #2586

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/Parallel/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

namespace PHPStan\Parallel;

use BlackfireProbe;
use Exception;
use PHPStan\ShouldNotHappenException;
use React\EventLoop\LoopInterface;
use React\EventLoop\TimerInterface;
use React\Stream\ReadableStreamInterface;
use React\Stream\WritableStreamInterface;
use Throwable;
use function class_exists;
use function fclose;
use function is_string;
use function rewind;
Expand Down Expand Up @@ -60,9 +62,16 @@ public function start(callable $onData, callable $onError, callable $onExit): vo
if ($tmpStdErr === false) {
throw new ShouldNotHappenException('Failed creating temp file for stderr.');
}

$env = $_ENV;
if (class_exists('BlackfireProbe') && BlackfireProbe::isEnabled()) {
$probe = BlackfireProbe::getMainInstance();
$env['BLACKFIRE_QUERY'] = $probe->createSubProfileQuery();
}

$this->stdOut = $tmpStdOut;
$this->stdErr = $tmpStdErr;
$this->process = new \React\ChildProcess\Process($this->command, null, null, [
$this->process = new \React\ChildProcess\Process($this->command, null, $env, [
1 => $this->stdOut,
2 => $this->stdErr,
]);
Expand Down
Loading