From e0060c8acf7df4d779040fd7075b30c347000555 Mon Sep 17 00:00:00 2001 From: Rhys Howell Date: Fri, 6 Dec 2024 12:58:38 -0500 Subject: [PATCH 1/2] fix(serverstats): update top write lock visual percentage --- packages/compass-serverstats/src/stores/top-store.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/compass-serverstats/src/stores/top-store.js b/packages/compass-serverstats/src/stores/top-store.js index 36ca6494ff7..339a0dec308 100644 --- a/packages/compass-serverstats/src/stores/top-store.js +++ b/packages/compass-serverstats/src/stores/top-store.js @@ -152,7 +152,7 @@ const TopStore = Reflux.createStore({ } t2s[collname] = { loadPercentR: value.readLock.time, - loadPercentL: value.writeLock.time, + loadPercentW: value.writeLock.time, loadPercent: value.total.time, }; } @@ -171,15 +171,15 @@ const TopStore = Reflux.createStore({ const t1 = collname in this.t1s ? this.t1s[collname] - : { loadPercent: 0, loadPercentR: 0, loadPercentL: 0 }; + : { loadPercent: 0, loadPercentR: 0, loadPercentW: 0 }; const t2 = t2s[collname]; const tDelta = t2.loadPercent - t1.loadPercent; - const loadL = + const loadW = tDelta === 0 ? 0 - : round(((t2.loadPercentL - t1.loadPercentL) / tDelta) * 100, 0); + : round(((t2.loadPercentW - t1.loadPercentW) / tDelta) * 100, 0); const loadR = tDelta === 0 ? 0 @@ -189,7 +189,7 @@ const TopStore = Reflux.createStore({ collectionName: collname, loadPercent: round((tDelta * 100) / (cadence * numCores), 2), // System load. loadPercentR: loadR, - loadPercentL: loadL, + loadPercentW: loadW, }); } this.t1s = t2s; From 68f33f5ba895e5d596cf3223464129758a81387b Mon Sep 17 00:00:00 2001 From: Rhys Howell Date: Sun, 15 Dec 2024 18:24:28 -0500 Subject: [PATCH 2/2] fixup: improve naming --- .../src/components/top-component.jsx | 4 ++-- .../src/stores/top-store.js | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/packages/compass-serverstats/src/components/top-component.jsx b/packages/compass-serverstats/src/components/top-component.jsx index f37b083e313..11b370b1263 100644 --- a/packages/compass-serverstats/src/components/top-component.jsx +++ b/packages/compass-serverstats/src/components/top-component.jsx @@ -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 (
  • diff --git a/packages/compass-serverstats/src/stores/top-store.js b/packages/compass-serverstats/src/stores/top-store.js index 339a0dec308..de6181780fc 100644 --- a/packages/compass-serverstats/src/stores/top-store.js +++ b/packages/compass-serverstats/src/stores/top-store.js @@ -151,8 +151,8 @@ const TopStore = Reflux.createStore({ debug('Error: top response from DB missing fields', value); } t2s[collname] = { - loadPercentR: value.readLock.time, - loadPercentW: value.writeLock.time, + loadPercentRead: value.readLock.time, + loadPercentWrite: value.writeLock.time, loadPercent: value.total.time, }; } @@ -171,25 +171,31 @@ const TopStore = Reflux.createStore({ const t1 = collname in this.t1s ? this.t1s[collname] - : { loadPercent: 0, loadPercentR: 0, loadPercentW: 0 }; + : { loadPercent: 0, loadPercentRead: 0, loadPercentWrite: 0 }; const t2 = t2s[collname]; const tDelta = t2.loadPercent - t1.loadPercent; - const loadW = + const loadWrite = tDelta === 0 ? 0 - : round(((t2.loadPercentW - t1.loadPercentW) / 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, - loadPercentW: loadW, + loadPercentRead: loadRead, + loadPercentWrite: loadWrite, }); } this.t1s = t2s;