flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetzger <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-1792] TM Monitoring: CPU utilization, h...
Date Fri, 10 Apr 2015 15:40:43 GMT
Github user rmetzger commented on a diff in the pull request:

    https://github.com/apache/flink/pull/553#discussion_r28155260
  
    --- Diff: flink-runtime/src/main/resources/web-docs-infoserver/js/taskmanager.js ---
    @@ -314,34 +376,74 @@ function updateLimit(element) {
                 $("#metrics-limit-all,#metrics-limit-none").removeClass("active");
                 $(element).addClass("active");
                 metricsLimit = 3;
    -            hideShowGraphs();
    +            hideShowMemStats();
                 break;
             case 'metrics-limit-all':
                 $("#metrics-limit-3,#metrics-limit-none").removeClass("active");
                 $(element).addClass("active");
                 metricsLimit = -1;
    -            hideShowGraphs();
    +            hideShowMemStats();
                 break;
             case 'metrics-limit-none':
                 $("#metrics-limit-all,#metrics-limit-3").removeClass("active");
                 $(element).addClass("active");
                 metricsLimit = 0;
    -            hideShowGraphs();
    +            hideShowMemStats();
                 break;
         }
     }
    +// toggle function for showing/hiding graphs
    +function hideShowGraph(tmid){
    +    var element = $("#chart_container-"+tmid);
    +    if(element.is(":visible")){
    +        $("#graph_button-"+tmid).text("Show Detailed Graph");
    +        element.hide();
    +        $("#tm-row-"+tmid+"-memory_stats").show();
    +    } else {
    +         $("#graph_button-"+tmid).text("Hide Detailed Graph");
    +         element.show();
    +         $("#tm-row-"+tmid+"-memory_stats").hide();
    +    }
    +}
     
    -function hideShowGraphs() {
    +// hide/show memory statistics for task managers according to metric limits
    +function hideShowMemStats() {
         var i = 0;
         for(tmid in taskManagerMemory) {
    +       // by default hide the graphs when Show/Disable Metrics is clicked
    +       if($("#chart_container-"+tmid).is(":visible")){
    +            $("#graph_button-"+tmid).text("Show Detailed Graph");
    +            $("#chart_container-"+tmid).hide();
    +       }
            if(metricsLimit == -1 || i++ < metricsLimit) {
    -            $("#chart_container-"+tmid).show();
    +            $("#tm-row-"+tmid+"-memory_stats").show();
    +            $("#graph_button-"+tmid).show();
            } else {
    -            $("#chart_container-"+tmid).hide();
    +            $("#tm-row-"+tmid+"-memory_stats").hide();
    +            $("#graph_button-"+tmid).hide();
            }
         }
     }
     
    +// generate summary for the last *time* minutes
    +function generateSummaryFor(stats,time){
    +    var summary = {};
    +    var numElements = time*12;
    +    for(var key in stats){
    +        if(key=="cpuLoad" && stats[key][0] && stats[key][0]['y']==-100){
    +            summary[key]="NA";
    +            continue;
    +        }
    +        var prevValues = stats[key].slice(numElements*-1);
    +        var sum = (prevValues.reduce(function(p,q){return {x:p.x+q.x,y:p.y+q.y}})).y;
    +        var avg = Number((sum/(prevValues.length)).toFixed(2));
    +        if (avg > 1024){
    +            avg = formatBase1024KMGTP(avg);
    +            }
    +        summary[key]=avg;
    +        }
    --- End diff --
    
    Could you try to make the code style consistent through your pull request?
    in some cases, the indentation is made using two spaces, sometimes its four.
    
    Here, the closing parenthesis `}` is on the same level, a few lines above, its one level
lower.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message