Skip to content

Commit d8fa426

Browse files
authored
Merge pull request #1 from aws-samples/elasticache/metrics
update readme - 2023-10-16-16-33
2 parents b684adc + 773ec49 commit d8fa426

File tree

4 files changed

+10
-25
lines changed

4 files changed

+10
-25
lines changed

frontend/public/aws-exports.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

frontend/src/components/CompElasticNode01.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const ComponentObject = memo(({ connectionId, clusterId, nodeId, instance, port,
3737
<td style={{"width":"9%", "text-align":"center", "border-top": "1pt solid " + configuration.colors.lines.separator100}}>
3838
<CompMetric04
3939
value={node.operations || 0}
40-
precision={2}
40+
precision={0}
4141
format={1}
4242
height={"30px"}
4343
width={"100px"}
@@ -51,7 +51,7 @@ const ComponentObject = memo(({ connectionId, clusterId, nodeId, instance, port,
5151
<td style={{"width":"9%", "text-align":"center", "border-top": "1pt solid " + configuration.colors.lines.separator100}}>
5252
<CompMetric04
5353
value={node.getCalls || 0}
54-
precision={2}
54+
precision={0}
5555
format={1}
5656
height={"30px"}
5757
width={"100px"}
@@ -65,7 +65,7 @@ const ComponentObject = memo(({ connectionId, clusterId, nodeId, instance, port,
6565
<td style={{"width":"9%", "text-align":"center", "border-top": "1pt solid " + configuration.colors.lines.separator100}}>
6666
<CompMetric04
6767
value={node.setCalls || 0}
68-
precision={2}
68+
precision={0}
6969
format={1}
7070
height={"30px"}
7171
width={"100px"}

server/api.core.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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"),

server/aws-exports.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)