Dwane Hall created SOLR-15251:
---------------------------------

             Summary: Metrics changes in Solr 8 cause admin dashboard to render 
incorrectly
                 Key: SOLR-15251
                 URL: https://issues.apache.org/jira/browse/SOLR-15251
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: Admin UI, metrics
    Affects Versions: 8.8.1
            Reporter: Dwane Hall


The metrics API appears to have changed between Solr 7 and 8. Some of the 
effected metrics are used on the Admin UI Dashboard view resulting the view not 
rendering correctly. The main culprits appear to be os.totalPhysicalMemorySize 
not being calculated in Solr 8 and two missing metrics os.totalSwapSpaceSize 
and os.freeSwapSpaceSize which are all used in the Dashboard view page.   
Values memory.heap.committed, memory.heap.init, memory.heap.max also appear to 
be using the identical value in Solr 8. Below is an extract of the javascrpit 
used on the Admin Dashboard and a comparison between metrics reported in Solr 7 
and 8.  The function "parse_memory_value" is where the JavaScript error appears 
to be thrown with the missing metrics.
{code:java}

Solr 8
"os.totalPhysicalMemorySize":0, (Not calculated)
"os.freePhysicalMemorySize":792087998464,
"os.totalSwapSpaceSize" (Metric not present)
"os.freeSwapSpaceSize": (Metric not present)
"memory.heap.committed":8589934592,
"memory.heap.init":8589934592,
"memory.heap.max":8589934592,
"memory.heap.usage":0.006413557566702366,
"memory.heap.used":55092040,
"memory.non-heap.committed":97910784,
"memory.non-heap.init":7667712,
"memory.non-heap.max":-1,
"memory.non-heap.usage":-9.2249552E7,
"memory.non-heap.used":92249712,

 Solr 7
"os.totalPhysicalMemorySize":810586099712,
"os.freePhysicalMemorySize":756665888768,
"os.totalSwapSpaceSize":0,
"os.freeSwapSpaceSize":0
"memory.heap.committed":12348030976,
"memory.heap.init":12884901888,
"memory.heap.max":12348030976,
"memory.heap.usage":0.313836514301922,
"memory.heap.used":3875263000,
"memory.non-heap.committed":145039360,
"memory.non-heap.init":7667712,
"memory.non-heap.max":-1,
"memory.non-heap.usage":-1.30145664E8,
"memory.non-heap.used":130145824, 

+main.js (Admin Dashboard)+

// physical memory
var memoryMax = parse_memory_value(data.system.totalPhysicalMemorySize);
$scope.memoryTotal = parse_memory_value(data.system.totalPhysicalMemorySize - 
data.system.freePhysicalMemorySize);
$scope.memoryPercentage = ($scope.memoryTotal / memoryMax * 100).toFixed(1)+ 
"%";
$scope.memoryMax = pretty_print_bytes(memoryMax);
$scope.memoryTotalDisplay = pretty_print_bytes($scope.memoryTotal);

// swap space
var swapMax = parse_memory_value(data.system.totalSwapSpaceSize);
$scope.swapTotal = parse_memory_value(data.system.totalSwapSpaceSize - 
data.system.freeSwapSpaceSize);
$scope.swapPercentage = ($scope.swapTotal / swapMax * 100).toFixed(1)+ "%";
$scope.swapMax = pretty_print_bytes(swapMax);
$scope.swapTotalDisplay = pretty_print_bytes($scope.swapTotal); 

// file handles
$scope.fileDescriptorPercentage = (data.system.openFileDescriptorCount / 
data.system.maxFileDescriptorCount *100).toFixed(1) + "%";

// java memory
var javaMemoryMax = parse_memory_value(data.jvm.memory.raw.max || 
data.jvm.memory.max);
$scope.javaMemoryTotal = parse_memory_value(data.jvm.memory.raw.total || 
data.jvm.memory.total);
$scope.javaMemoryUsed = parse_memory_value(data.jvm.memory.raw.used || 
data.jvm.memory.used);
$scope.javaMemoryTotalPercentage = ($scope.javaMemoryTotal / javaMemoryMax 
*100).toFixed(1) + "%";
$scope.javaMemoryUsedPercentage = ($scope.javaMemoryUsed / 
$scope.javaMemoryTotal *100).toFixed(1) + "%";
$scope.javaMemoryPercentage = ($scope.javaMemoryUsed / javaMemoryMax * 
100).toFixed(1) + "%";
$scope.javaMemoryTotalDisplay = pretty_print_bytes($scope.javaMemoryTotal);
$scope.javaMemoryUsedDisplay = pretty_print_bytes($scope.javaMemoryUsed);  // 
@todo These should really be an AngularJS Filter: {{ javaMemoryUsed | bytes }}
$scope.javaMemoryMax = pretty_print_bytes(javaMemoryMax);

var parse_memory_value = function( value ) {

  if( value !== Number( value ) )
  {
    var units = 'BKMGTPEZY';
    var match = value.match( /^(\d+([,\.]\d+)?) (\w).*$/ );
    var value = parseFloat( match[1] ) * Math.pow( 1024, units.indexOf( 
match[3].toUpperCase() ) );

  }
  return value;
};
{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to