@@ -2744,6 +2744,8 @@ async function updateStatsRedisNode(connectionId,clusterId,nodeId) {
27442744
27452745 //-- Node Command Stats
27462746 var command = await dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "connection" ] . sendCommand ( [ 'INFO' , 'Commandstats' ] ) ;
2747+
2748+ var totalCalls = 0 ;
27472749 var iRowLine = 0 ;
27482750 var dataResult = "" ;
27492751 command . split ( / \r ? \n / ) . forEach ( ( line ) => {
@@ -2759,6 +2761,8 @@ async function updateStatsRedisNode(connectionId,clusterId,nodeId) {
27592761 var key = metric [ 0 ] ;
27602762 var value = metric [ 1 ] ;
27612763 metricList = metricList + '"' + key + '":' + value + "," ;
2764+ if ( key == "calls" )
2765+ totalCalls = totalCalls + parseFloat ( value ) ;
27622766
27632767 } ) ;
27642768 dataResult = dataResult + '"' + metricGropuName + '": { ' + metricList . slice ( 0 , - 1 ) + ' },' ;
@@ -2773,7 +2777,6 @@ async function updateStatsRedisNode(connectionId,clusterId,nodeId) {
27732777 } ) ;
27742778
27752779 var jsonCommands = JSON . parse ( '{' + dataResult . slice ( 0 , - 1 ) + ' } ' ) ;
2776-
27772780
27782781 dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . newSnapshot ( {
27792782 name : "" ,
@@ -2783,7 +2786,7 @@ async function updateStatsRedisNode(connectionId,clusterId,nodeId) {
27832786 memory : 0 ,
27842787 memoryUsed : parseFloat ( jsonInfo [ 'used_memory' ] ) ,
27852788 memoryTotal : parseFloat ( jsonInfo [ 'maxmemory' ] ) ,
2786- operations : parseFloat ( jsonInfo [ 'instantaneous_ops_per_sec' ] ) ,
2789+ operations : totalCalls ,
27872790 getCalls : ( ( jsonCommands . hasOwnProperty ( 'cmdstat_get' ) ) ? parseFloat ( jsonCommands [ 'cmdstat_get' ] [ 'calls' ] ) : 0 ) ,
27882791 getUsec : ( ( jsonCommands . hasOwnProperty ( 'cmdstat_get' ) ) ? parseFloat ( jsonCommands [ 'cmdstat_get' ] [ 'usec' ] ) : 0 ) ,
27892792 setCalls : ( ( jsonCommands . hasOwnProperty ( 'cmdstat_set' ) ) ? parseFloat ( jsonCommands [ 'cmdstat_set' ] [ 'calls' ] ) : 0 ) ,
@@ -2867,7 +2870,7 @@ async function gatherStatsRedisCluster(req, res) {
28672870 ) ;
28682871
28692872 dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . addPropertyValue ( 'connectedClients' , currentNode . getValueByIndex ( "connectedClients" ) ) ;
2870- dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . addPropertyValue ( 'operations' , currentNode . getDeltaByIndex ( "getCalls" ) + currentNode . getDeltaByIndex ( "setCalls ") ) ;
2873+ dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . addPropertyValue ( 'operations' , currentNode . getDeltaByIndex ( "operations " ) ) ;
28712874 dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . addPropertyValue ( 'getCalls' , currentNode . getDeltaByIndex ( "getCalls" ) ) ;
28722875 dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . addPropertyValue ( 'setCalls' , currentNode . getDeltaByIndex ( "setCalls" ) ) ;
28732876 dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . addPropertyValue ( 'getLatency' , currentNode . getDeltaByIndex ( "getUsec" ) / currentNode . getDeltaByIndex ( "getCalls" ) ) ;
@@ -2888,7 +2891,7 @@ async function gatherStatsRedisCluster(req, res) {
28882891 memory : ( currentNode . getValueByIndex ( "memoryUsed" ) / currentNode . getValueByIndex ( "memoryTotal" ) ) * 100 ,
28892892 memoryUsed : currentNode . getValueByIndex ( "memoryUsed" ) ,
28902893 memoryTotal : currentNode . getValueByIndex ( "memoryTotal" ) ,
2891- operations : currentNode . getDeltaByIndex ( "getCalls" ) + currentNode . getDeltaByIndex ( "setCalls ") ,
2894+ operations : currentNode . getDeltaByIndex ( "operations " ) ,
28922895 getCalls : currentNode . getDeltaByIndex ( "getCalls" ) ,
28932896 setCalls : currentNode . getDeltaByIndex ( "setCalls" ) ,
28942897 connectedClients : currentNode . getValueByIndex ( "connectedClients" ) ,
0 commit comments