Skip to content

Commit

Permalink
fix(serverstats): update top chart write lock percentage of load visual
Browse files Browse the repository at this point in the history
  • Loading branch information
Anemy authored Dec 16, 2024
1 parent 7abde1e commit 775f76d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/compass-serverstats/src/components/top-component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ class TopComponent extends React.Component {
renderGraph() {
const rows = this.state.data.map(function (row, i) {
const styleLoad = { width: `${row.loadPercent}%` };
const styleLoadR = { width: `${row.loadPercentR}%` };
const styleLoadW = { width: `${row.loadPercentW}%` };
const styleLoadR = { width: `${row.loadPercentRead}%` };
const styleLoadW = { width: `${row.loadPercentWrite}%` };

return (
<li className="rt-lists__item" key={`list-item-${i}`}>
Expand Down
24 changes: 15 additions & 9 deletions packages/compass-serverstats/src/stores/top-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ const TopStore = Reflux.createStore({
debug('Error: top response from DB missing fields', value);
}
t2s[collname] = {
loadPercentR: value.readLock.time,
loadPercentL: value.writeLock.time,
loadPercentRead: value.readLock.time,
loadPercentWrite: value.writeLock.time,
loadPercent: value.total.time,
};
}
Expand All @@ -171,25 +171,31 @@ const TopStore = Reflux.createStore({
const t1 =
collname in this.t1s
? this.t1s[collname]
: { loadPercent: 0, loadPercentR: 0, loadPercentL: 0 };
: { loadPercent: 0, loadPercentRead: 0, loadPercentWrite: 0 };
const t2 = t2s[collname];

const tDelta = t2.loadPercent - t1.loadPercent;

const loadL =
const loadWrite =
tDelta === 0
? 0
: round(((t2.loadPercentL - t1.loadPercentL) / tDelta) * 100, 0);
const loadR =
: round(
((t2.loadPercentWrite - t1.loadPercentWrite) / tDelta) * 100,
0
);
const loadRead =
tDelta === 0
? 0
: round(((t2.loadPercentR - t1.loadPercentR) / tDelta) * 100, 0);
: round(
((t2.loadPercentRead - t1.loadPercentRead) / tDelta) * 100,
0
);

totals.push({
collectionName: collname,
loadPercent: round((tDelta * 100) / (cadence * numCores), 2), // System load.
loadPercentR: loadR,
loadPercentL: loadL,
loadPercentRead: loadRead,
loadPercentWrite: loadWrite,
});
}
this.t1s = t2s;
Expand Down

0 comments on commit 775f76d

Please sign in to comment.