You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/08/09 05:56:59 UTC

[GitHub] [incubator-ratis] amaliujia opened a new pull request #174: RATIS-1029. NPE at MetricServerInterceptor.interceptCall

amaliujia opened a new pull request #174:
URL: https://github.com/apache/incubator-ratis/pull/174


   ## What changes were proposed in this pull request?
   When identifier is not NULL, `metrics` variable will not be initialized: https://github.com/apache/incubator-ratis/blob/349c365e81d76b210df7a97704217178e3f7f826/ratis-grpc/src/main/java/org/apache/ratis/grpc/metrics/intercept/server/MetricServerInterceptor.java#L71
   
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/RATIS-1029
   
   ## How was this patch tested?
   
   UT
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-ratis] amaliujia commented on pull request #174: RATIS-1029. NPE at MetricServerInterceptor.interceptCall

Posted by GitBox <gi...@apache.org>.
amaliujia commented on pull request #174:
URL: https://github.com/apache/incubator-ratis/pull/174#issuecomment-671010918


   This PR is related to #159.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-ratis] anshkhannasbu commented on a change in pull request #174: RATIS-1029. NPE at MetricServerInterceptor.interceptCall

Posted by GitBox <gi...@apache.org>.
anshkhannasbu commented on a change in pull request #174:
URL: https://github.com/apache/incubator-ratis/pull/174#discussion_r467547624



##########
File path: ratis-grpc/src/main/java/org/apache/ratis/grpc/metrics/intercept/server/MetricServerInterceptor.java
##########
@@ -62,14 +62,14 @@ private String getMethodMetricPrefix(MethodDescriptor<?, ?> method){
       Metadata requestHeaders,
       ServerCallHandler<R, S> next) {
     MethodDescriptor<R, S> method = call.getMethodDescriptor();
-    if(identifier == null){
+    if (identifier == null) {
       try {
         identifier = peerIdSupplier.get().toString();
-      } catch (Exception e){
+      } catch (Exception e) {
         identifier = defaultIdentifier;
       }
-      metrics = new MessageMetrics(identifier, "server");
     }
+    metrics = new MessageMetrics(identifier, "server");

Review comment:
       This will probably create a new metrics info for every invocation. I think we should move it to an else in case identifier is not null and check if metrics are set or not.
   ```suggestion
       else{
            if(metrics == null){
               metrics = new MessageMetrics(identifier, "server");
            }
       }
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-ratis] anshkhannasbu commented on pull request #174: RATIS-1029. NPE at MetricServerInterceptor.interceptCall

Posted by GitBox <gi...@apache.org>.
anshkhannasbu commented on pull request #174:
URL: https://github.com/apache/incubator-ratis/pull/174#issuecomment-671018282


   > @anshkhannasbu
   > 
   > I accepted your suggestion and then give another look. I think it is better to have a separate `if (metrics == null)` check (see my last commit). WDYT?
   
   @amaliujia sure looks good.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-ratis] amaliujia commented on pull request #174: RATIS-1029. NPE at MetricServerInterceptor.interceptCall

Posted by GitBox <gi...@apache.org>.
amaliujia commented on pull request #174:
URL: https://github.com/apache/incubator-ratis/pull/174#issuecomment-671010842


   R: @anshkhannasbu @bshashikant 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-ratis] bshashikant merged pull request #174: RATIS-1029. NPE at MetricServerInterceptor.interceptCall

Posted by GitBox <gi...@apache.org>.
bshashikant merged pull request #174:
URL: https://github.com/apache/incubator-ratis/pull/174


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-ratis] anshkhannasbu commented on pull request #174: RATIS-1029. NPE at MetricServerInterceptor.interceptCall

Posted by GitBox <gi...@apache.org>.
anshkhannasbu commented on pull request #174:
URL: https://github.com/apache/incubator-ratis/pull/174#issuecomment-671017173


   @amaliujia, if the identifier is not null then metrics should be set. Since there is no other way to set the identifier. Is there some case where metrics cannot be created?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-ratis] amaliujia commented on pull request #174: RATIS-1029. NPE at MetricServerInterceptor.interceptCall

Posted by GitBox <gi...@apache.org>.
amaliujia commented on pull request #174:
URL: https://github.com/apache/incubator-ratis/pull/174#issuecomment-671018098


   @anshkhannasbu 
   
   I accepted your suggestion and then give another look.  I think it is better to have a separate `if (metrics == null)` check (see my last commit). WDYT? 


----------------------------------------------------------------
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:
users@infra.apache.org