Skip to content

Commit 775f76d

Browse files
authored
fix(serverstats): update top chart write lock percentage of load visual COMPASS-8604 (#6553)
1 parent 7abde1e commit 775f76d

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

packages/compass-serverstats/src/components/top-component.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ class TopComponent extends React.Component {
130130
renderGraph() {
131131
const rows = this.state.data.map(function (row, i) {
132132
const styleLoad = { width: `${row.loadPercent}%` };
133-
const styleLoadR = { width: `${row.loadPercentR}%` };
134-
const styleLoadW = { width: `${row.loadPercentW}%` };
133+
const styleLoadR = { width: `${row.loadPercentRead}%` };
134+
const styleLoadW = { width: `${row.loadPercentWrite}%` };
135135

136136
return (
137137
<li className="rt-lists__item" key={`list-item-${i}`}>

packages/compass-serverstats/src/stores/top-store.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ const TopStore = Reflux.createStore({
151151
debug('Error: top response from DB missing fields', value);
152152
}
153153
t2s[collname] = {
154-
loadPercentR: value.readLock.time,
155-
loadPercentL: value.writeLock.time,
154+
loadPercentRead: value.readLock.time,
155+
loadPercentWrite: value.writeLock.time,
156156
loadPercent: value.total.time,
157157
};
158158
}
@@ -171,25 +171,31 @@ const TopStore = Reflux.createStore({
171171
const t1 =
172172
collname in this.t1s
173173
? this.t1s[collname]
174-
: { loadPercent: 0, loadPercentR: 0, loadPercentL: 0 };
174+
: { loadPercent: 0, loadPercentRead: 0, loadPercentWrite: 0 };
175175
const t2 = t2s[collname];
176176

177177
const tDelta = t2.loadPercent - t1.loadPercent;
178178

179-
const loadL =
179+
const loadWrite =
180180
tDelta === 0
181181
? 0
182-
: round(((t2.loadPercentL - t1.loadPercentL) / tDelta) * 100, 0);
183-
const loadR =
182+
: round(
183+
((t2.loadPercentWrite - t1.loadPercentWrite) / tDelta) * 100,
184+
0
185+
);
186+
const loadRead =
184187
tDelta === 0
185188
? 0
186-
: round(((t2.loadPercentR - t1.loadPercentR) / tDelta) * 100, 0);
189+
: round(
190+
((t2.loadPercentRead - t1.loadPercentRead) / tDelta) * 100,
191+
0
192+
);
187193

188194
totals.push({
189195
collectionName: collname,
190196
loadPercent: round((tDelta * 100) / (cadence * numCores), 2), // System load.
191-
loadPercentR: loadR,
192-
loadPercentL: loadL,
197+
loadPercentRead: loadRead,
198+
loadPercentWrite: loadWrite,
193199
});
194200
}
195201
this.t1s = t2s;

0 commit comments

Comments
 (0)