You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/06/25 14:50:23 UTC

[GitHub] [skywalking] 844067874 opened a new issue #7175: the average time of gRPC is not right

844067874 opened a new issue #7175:
URL: https://github.com/apache/skywalking/issues/7175


   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [x] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Question
   - What do you want to know?
   
   ___
   ### Bug
   - Which version of SkyWalking, OS, and JRE?
   V8.5.0
   - Which company or project?
   
   - What happened?
   the grpc agent plugin has a problem,the average time of gRPC is not right.
   ![image](https://user-images.githubusercontent.com/11434590/123441146-1d9e6600-d606-11eb-89e0-0c59a96e378f.png)
   ![image](https://user-images.githubusercontent.com/11434590/123442174-2fccd400-d607-11eb-821a-c82aa1b59d88.png)
   
   ```
   org.apache.skywalking.apm.plugin.grpc.v1.server.ServerInterceptor
   
   final AbstractSpan span = ContextManager.createEntrySpan(OperationNameFormatUtil.formatOperationName(call.getMethodDescriptor()), contextCarrier);
           span.setComponent(ComponentsDefine.GRPC);
           span.setLayer(SpanLayer.RPC_FRAMEWORK);
           try {
               return new TracingServerCallListener<>(handler.startCall(new TracingServerCall<>(call, ContextManager.capture()), headers), call
                   .getMethodDescriptor(), ContextManager.capture());
           } finally {
               ContextManager.stopSpan();
           }
   ```
    the entry  endpoint  just cost a few milliseconds,it The does not include  actual execution time of a gRPC,which is really in 
   the endpoint of xxxxx/Request/onComplete.At present,the average time of gRPC is not right.
   ```
   org.apache.skywalking.apm.plugin.grpc.v1.server.TracingServerCallListener
   
   @Override
       public void onHalfClose() {
           final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_COMPLETE_OPERATION_NAME);
           span.setComponent(ComponentsDefine.GRPC);
           span.setLayer(SpanLayer.RPC_FRAMEWORK);
           ContextManager.continued(contextSnapshot);
   
           try {
               super.onHalfClose();
           } catch (Throwable t) {
               ContextManager.activeSpan().log(t);
               throw t;
           } finally {
               ContextManager.stopSpan();
           }
       }
   
   
   ```
   
   ___
   ### Requirement or improvement
   - Please describe your requirements or improvement suggestions.
   ```
   org.apache.skywalking.apm.plugin.grpc.v1.server.ServerInterceptor
   
   @Override
       public <REQUEST, RESPONSE> ServerCall.Listener<REQUEST> interceptCall(ServerCall<REQUEST, RESPONSE> call,
           Metadata headers, ServerCallHandler<REQUEST, RESPONSE> handler) {
           final ContextCarrier contextCarrier = new ContextCarrier();
           CarrierItem next = contextCarrier.items();
           while (next.hasNext()) {
               next = next.next();
               String contextValue = headers.get(Metadata.Key.of(next.getHeadKey(), Metadata.ASCII_STRING_MARSHALLER));
               if (!StringUtil.isEmpty(contextValue)) {
                   next.setHeadValue(contextValue);
               }
           }
   
           final AbstractSpan span = ContextManager.createEntrySpan(OperationNameFormatUtil.formatOperationName(call.getMethodDescriptor()), contextCarrier);
           span.setComponent(ComponentsDefine.GRPC);
           span.setLayer(SpanLayer.RPC_FRAMEWORK);
           return new TracingServerCallListener<>(handler.startCall(new TracingServerCall<>(call, ContextManager.capture()), headers), call
               .getMethodDescriptor(), ContextManager.capture());
   
       }
   
   ```
   ```
   org.apache.skywalking.apm.plugin.grpc.v1.server.TracingServerCallListener#TracingServerCallListener
   
   @Override
       public void onHalfClose() {
           final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_COMPLETE_OPERATION_NAME);
           span.setComponent(ComponentsDefine.GRPC);
           span.setLayer(SpanLayer.RPC_FRAMEWORK);
           ContextManager.continued(contextSnapshot);
   
           try {
               super.onHalfClose();
           } catch (Throwable t) {
               ContextManager.activeSpan().log(t);
               throw t;
           } finally {
               ContextManager.stopSpan();
               try {
                   AbstractSpan abstractSpan = ContextManager.activeSpan();
                   ContextManager.stopSpan(abstractSpan);
               } catch (Exception e) {
                  throw e;
               }
           }
       }
   
   
   
   
   
   ```


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng closed issue #7175: the average response time of gRPC is not right

Posted by GitBox <gi...@apache.org>.
wu-sheng closed issue #7175:
URL: https://github.com/apache/skywalking/issues/7175


   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on issue #7175: the average response time of gRPC is not right

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #7175:
URL: https://github.com/apache/skywalking/issues/7175#issuecomment-868563343


   If you want to propose some enhancement, send a pull request. Issue discussion is about idea or poc codes, existing codes changing is hard to follow in this way.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on issue #7175: the average response time of gRPC is not right

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #7175:
URL: https://github.com/apache/skywalking/issues/7175#issuecomment-868564185


   You paste many code segments, it is hard to understand. Many plugins were not written by current maintainers. 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org