@@ -2744,6 +2744,8 @@ async function updateStatsRedisNode(connectionId,clusterId,nodeId) {
2744
2744
2745
2745
//-- Node Command Stats
2746
2746
var command = await dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "connection" ] . sendCommand ( [ 'INFO' , 'Commandstats' ] ) ;
2747
+
2748
+ var totalCalls = 0 ;
2747
2749
var iRowLine = 0 ;
2748
2750
var dataResult = "" ;
2749
2751
command . split ( / \r ? \n / ) . forEach ( ( line ) => {
@@ -2759,6 +2761,8 @@ async function updateStatsRedisNode(connectionId,clusterId,nodeId) {
2759
2761
var key = metric [ 0 ] ;
2760
2762
var value = metric [ 1 ] ;
2761
2763
metricList = metricList + '"' + key + '":' + value + "," ;
2764
+ if ( key == "calls" )
2765
+ totalCalls = totalCalls + parseFloat ( value ) ;
2762
2766
2763
2767
} ) ;
2764
2768
dataResult = dataResult + '"' + metricGropuName + '": { ' + metricList . slice ( 0 , - 1 ) + ' },' ;
@@ -2773,7 +2777,6 @@ async function updateStatsRedisNode(connectionId,clusterId,nodeId) {
2773
2777
} ) ;
2774
2778
2775
2779
var jsonCommands = JSON . parse ( '{' + dataResult . slice ( 0 , - 1 ) + ' } ' ) ;
2776
-
2777
2780
2778
2781
dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . newSnapshot ( {
2779
2782
name : "" ,
@@ -2783,7 +2786,7 @@ async function updateStatsRedisNode(connectionId,clusterId,nodeId) {
2783
2786
memory : 0 ,
2784
2787
memoryUsed : parseFloat ( jsonInfo [ 'used_memory' ] ) ,
2785
2788
memoryTotal : parseFloat ( jsonInfo [ 'maxmemory' ] ) ,
2786
- operations : parseFloat ( jsonInfo [ 'instantaneous_ops_per_sec' ] ) ,
2789
+ operations : totalCalls ,
2787
2790
getCalls : ( ( jsonCommands . hasOwnProperty ( 'cmdstat_get' ) ) ? parseFloat ( jsonCommands [ 'cmdstat_get' ] [ 'calls' ] ) : 0 ) ,
2788
2791
getUsec : ( ( jsonCommands . hasOwnProperty ( 'cmdstat_get' ) ) ? parseFloat ( jsonCommands [ 'cmdstat_get' ] [ 'usec' ] ) : 0 ) ,
2789
2792
setCalls : ( ( jsonCommands . hasOwnProperty ( 'cmdstat_set' ) ) ? parseFloat ( jsonCommands [ 'cmdstat_set' ] [ 'calls' ] ) : 0 ) ,
@@ -2867,7 +2870,7 @@ async function gatherStatsRedisCluster(req, res) {
2867
2870
) ;
2868
2871
2869
2872
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 " ) ) ;
2871
2874
dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . addPropertyValue ( 'getCalls' , currentNode . getDeltaByIndex ( "getCalls" ) ) ;
2872
2875
dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . addPropertyValue ( 'setCalls' , currentNode . getDeltaByIndex ( "setCalls" ) ) ;
2873
2876
dbRedisCluster [ connectionId ] [ clusterId ] [ nodeId ] [ "node" ] . addPropertyValue ( 'getLatency' , currentNode . getDeltaByIndex ( "getUsec" ) / currentNode . getDeltaByIndex ( "getCalls" ) ) ;
@@ -2888,7 +2891,7 @@ async function gatherStatsRedisCluster(req, res) {
2888
2891
memory : ( currentNode . getValueByIndex ( "memoryUsed" ) / currentNode . getValueByIndex ( "memoryTotal" ) ) * 100 ,
2889
2892
memoryUsed : currentNode . getValueByIndex ( "memoryUsed" ) ,
2890
2893
memoryTotal : currentNode . getValueByIndex ( "memoryTotal" ) ,
2891
- operations : currentNode . getDeltaByIndex ( "getCalls" ) + currentNode . getDeltaByIndex ( "setCalls ") ,
2894
+ operations : currentNode . getDeltaByIndex ( "operations " ) ,
2892
2895
getCalls : currentNode . getDeltaByIndex ( "getCalls" ) ,
2893
2896
setCalls : currentNode . getDeltaByIndex ( "setCalls" ) ,
2894
2897
connectedClients : currentNode . getValueByIndex ( "connectedClients" ) ,
0 commit comments