wu-sheng commented on a change in pull request #3145: Fixed java agent cannot 
trace gRPC stream service
URL: https://github.com/apache/skywalking/pull/3145#discussion_r307178002
 
 

 ##########
 File path: 
apm-sniffer/apm-sdk-plugin/grpc-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/grpc/v1/StreamCallClientInterceptor.java
 ##########
 @@ -95,18 +95,25 @@ protected CallListener(Listener delegate, ContextSnapshot 
contextSnapshot) {
             this.contextSnapshot = contextSnapshot;
         }
 
-        @Override public void onReady() {
+        @Override
+        public void onReady() {
             delegate().onReady();
         }
 
-        @Override public void onHeaders(Metadata headers) {
+        @Override
+        public void onHeaders(Metadata headers) {
             delegate().onHeaders(headers);
         }
 
-        @Override public void onMessage(Object message) {
+        @Override
+        public void onMessage(Object message) {
             try {
                 ContextManager.createLocalSpan(operationPrefix + 
STREAM_RESPONSE_OBSERVER_ON_NEXT_OPERATION_NAME);
                 ContextManager.continued(contextSnapshot);
+            } catch (Throwable t) {
+                // ignore trace error
 
 Review comment:
   No, you should not do that. You should check the `contextSnapshot != null`. 
Exception throw/catch is a heavy OP, it costs more CPU than you thought.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to