-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add record rpc server * Improve telescope middleware * optimize code * Fix TelescopeMiddleware to record service or request based on server type * Update telescope README.md to include rpc server/client * Update README.md * Add record rpc server * Improve telescope middleware * optimize code * Fix TelescopeMiddleware to record service or request based on server type * Update telescope README.md to include rpc server/client * Update README.md * Fix RequestHandledListener to record service or --------- Co-authored-by: Deeka Wong <[email protected]>
- Loading branch information
1 parent
8defbaa
commit 3475a13
Showing
8 changed files
with
178 additions
and
45 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
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
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,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of friendsofhyperf/components. | ||
* | ||
* @link https://github.com/friendsofhyperf/components | ||
* @document https://github.com/friendsofhyperf/components/blob/main/README.md | ||
* @contact [email protected] | ||
*/ | ||
|
||
namespace FriendsOfHyperf\Telescope\Aspect; | ||
|
||
use FriendsOfHyperf\Telescope\SwitchManager; | ||
use FriendsOfHyperf\Telescope\TelescopeContext; | ||
use Hyperf\Di\Aop\AbstractAspect; | ||
use Hyperf\Di\Aop\ProceedingJoinPoint; | ||
use Hyperf\Rpc\Context; | ||
use Hyperf\RpcClient\AbstractServiceClient; | ||
|
||
use function Hyperf\Tappable\tap; | ||
|
||
class RpcAspect extends AbstractAspect | ||
{ | ||
public array $classes = [ | ||
AbstractServiceClient::class . '::__generateRpcPath', | ||
]; | ||
|
||
public function __construct(protected SwitchManager $switcherManager, protected Context $context) | ||
{ | ||
} | ||
|
||
public function process(ProceedingJoinPoint $proceedingJoinPoint) | ||
{ | ||
return tap($proceedingJoinPoint->process(), function () { | ||
if (static::class == self::class && $this->switcherManager->isEnable('rpc') === false) { | ||
return; | ||
} | ||
|
||
$carrier = []; | ||
$carrier['batch-id'] = TelescopeContext::getBatchId(); | ||
$this->context->set('telescope.carrier', $carrier); | ||
}); | ||
} | ||
} |
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
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