akiyamaneko commented on a change in pull request #3243:
URL: https://github.com/apache/ambari/pull/3243#discussion_r504611502



##########
File path: ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
##########
@@ -273,7 +273,7 @@ define([
             }
             var metricTransform = !target.transform || target.transform === 
"none" ? '' : '._' + target.transform;
             var seriesAggregator = !target.seriesAggregator || 
target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + 
target.seriesAggregator;
-            var templatedComponent = (_.isEmpty(tComponent)) ? target.app : 
tComponent;
+            var templatedComponent = (_.isEmpty(target.app)) ? tComponent : 
target.app;

Review comment:
       @payert  thanks for your review.
   1. the metrics I changed are not new metrics, they have been added in 
metrics_whitelist, please look at: 
[metrics_whitelist#529](https://github.com/apache/ambari/blob/9cfc3c1ed4be10cdbae6d1bbab85189ee62624f2/ambari-metrics/ambari-metrics-timelineservice/conf/unix/metrics_whitelist#L529)
   
   2. In Grafana HDFS NameNode Page, The backend query url will be like this:
   
"/ws/v1/timeline/metrics?metricNames=rpc.rpc.CallQueueLength._avg&hostname=%&**appId=namenode**&instanceId=&startTime=XXX
 &endTime=XXX",   
   **The parameter appid in query URL is namenode, but the missing metrics must 
be queried  from `appid=datanode`.**
   appId is obtained from templatedComponent,as the history code `var 
templatedComponent = (_.isEmpty(tComponent)) ? target.app : tComponent;` ,   
`tComponent` is a global variable and it will never be empty, so the value of 
appId is always 'namenode'.  
   Therefore I change the way to init templatedComponent to ensure the 
templatedComponent use the target.app first. 
   
   
   Although I have checked other metrics and no problem had been found so far. 
I am also worried that my modification to `datasource.js` will affect other 
metrics.  Do you have any Suggestions?
   
   
   
   
   
   




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


Reply via email to