Skip to content

Commit

Permalink
Fix glances network calculation (#2201)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon authored Oct 17, 2023
1 parent 2f4985b commit 47db8be
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/widgets/glances/metrics/net.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function Component({ service }) {

if (interfaceData) {
setDataPoints((prevDataPoints) => {
const newDataPoints = [...prevDataPoints, { a: interfaceData.tx, b: interfaceData.rx }];
const newDataPoints = [...prevDataPoints, { a: (interfaceData.rx * 8) / interfaceData.time_since_update, b: (interfaceData.tx * 8) / interfaceData.time_since_update }];
if (newDataPoints.length > pointsLimit) {
newDataPoints.shift();
}
Expand Down Expand Up @@ -59,8 +59,8 @@ export default function Component({ service }) {
{ chart && (
<ChartDual
dataPoints={dataPoints}
label={[t("docker.tx"), t("docker.rx")]}
formatter={(value) => t("common.byterate", {
label={[t("docker.rx"), t("docker.tx")]}
formatter={(value) => t("common.bitrate", {
value,
maximumFractionDigits: 0,
})}
Expand All @@ -76,9 +76,9 @@ export default function Component({ service }) {

<div className="text-xs opacity-75">
{t("common.bitrate", {
value: interfaceData.tx,
value: (interfaceData.rx * 8) / interfaceData.time_since_update,
maximumFractionDigits: 0,
})} {t("docker.tx")}
})} {t("docker.rx")}
</div>
</Block>

Expand All @@ -95,9 +95,9 @@ export default function Component({ service }) {
<Block position="bottom-3 right-3">
<div className="text-xs opacity-75">
{t("common.bitrate", {
value: interfaceData.rx,
value: (interfaceData.tx * 8) / interfaceData.time_since_update,
maximumFractionDigits: 0,
})} {t("docker.rx")}
})} {t("docker.tx")}
</div>
</Block>
</Container>
Expand Down

0 comments on commit 47db8be

Please sign in to comment.