-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add trackers and connection info to status command
- Loading branch information
Showing
11 changed files
with
511 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace JKocik\Laravel\Profiler\Events; | ||
|
||
class ProfilerServerConnectionFailed | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace JKocik\Laravel\Profiler\Events; | ||
|
||
class ProfilerServerConnectionSuccessful | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
public $socketsPort; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
public $countClients; | ||
|
||
/** | ||
* ProfilerServerConnectionSuccessful constructor. | ||
* @param int $socketsPort | ||
* @param int $countClients | ||
*/ | ||
public function __construct(int $socketsPort, int $countClients) | ||
{ | ||
$this->socketsPort = $socketsPort; | ||
$this->countClients = $countClients; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace JKocik\Laravel\Profiler\Processors; | ||
|
||
use GuzzleHttp\Exception\ConnectException; | ||
use JKocik\Laravel\Profiler\Contracts\DataTracker; | ||
use JKocik\Laravel\Profiler\Events\ProfilerServerConnectionFailed; | ||
use JKocik\Laravel\Profiler\Events\ProfilerServerConnectionSuccessful; | ||
|
||
class StatusCommandProcessor extends BroadcastingProcessor | ||
{ | ||
/** | ||
* @param DataTracker $dataTracker | ||
* @return void | ||
*/ | ||
public function process(DataTracker $dataTracker): void | ||
{ | ||
try { | ||
$response = $this->broadcast( | ||
$dataTracker, | ||
$this->configService->serverHttpConnectionUrl() . '/status' | ||
); | ||
|
||
$body = json_decode($response->getBody()); | ||
|
||
event(new ProfilerServerConnectionSuccessful($body->sockets, $body->clients)); | ||
} catch (ConnectException $e) { | ||
event(new ProfilerServerConnectionFailed()); | ||
throw $e; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.