File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1515use FriendsOfHyperf \Sentry \Feature ;
1616use Hyperf \Di \Aop \AbstractAspect ;
1717use Hyperf \Di \Aop \ProceedingJoinPoint ;
18+ use Hyperf \GrpcClient \BaseClient ;
19+ use Hyperf \GrpcClient \GrpcClient ;
1820use Sentry \SentrySdk ;
1921use Sentry \State \Scope ;
2022use Sentry \Tracing \SpanContext ;
@@ -38,12 +40,20 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint)
3840 return $ proceedingJoinPoint ->process ();
3941 }
4042
43+ /** @var BaseClient $instance */
44+ $ instance = $ proceedingJoinPoint ->getInstance ();
45+ /** @var GrpcClient $grpcClient */
46+ $ grpcClient = $ instance ->_getGrpcClient ();
47+ [$ serverAddress , $ serverPort ] = (fn () => [$ this ->host ?? null , $ this ->port ?? null ])->call ($ grpcClient );
48+
4149 $ method = $ proceedingJoinPoint ->arguments ['keys ' ]['method ' ];
4250 $ options = $ proceedingJoinPoint ->arguments ['keys ' ]['options ' ];
4351 $ data = [
4452 'rpc.system ' => 'grpc ' ,
4553 'rpc.method ' => $ method ,
4654 'rpc.options ' => $ options ,
55+ 'server.address ' => $ serverAddress ,
56+ 'server.port ' => $ serverPort ,
4757 ];
4858
4959 $ parent = SentrySdk::getCurrentHub ()->getSpan ();
You can’t perform that action at this time.
0 commit comments