feat: host metrics part 2 (#1972)

This commit is contained in:
James Rich 2025-05-28 16:10:35 -05:00 committed by GitHub
parent e31d4170b6
commit f48e127019
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 11 deletions

View file

@ -134,16 +134,20 @@ fun HostMetricsItem(
value = formatBytes(hostMetrics.diskfree1Bytes),
modifier = Modifier.fillMaxWidth(),
)
LogLine(
label = stringResource(R.string.disk_free) + " 2",
value = formatBytes(hostMetrics.diskfree2Bytes),
modifier = Modifier.fillMaxWidth(),
)
LogLine(
label = stringResource(R.string.disk_free) + " 3",
value = formatBytes(hostMetrics.diskfree3Bytes),
modifier = Modifier.fillMaxWidth(),
)
if (hostMetrics.hasDiskfree2Bytes()) {
LogLine(
label = stringResource(R.string.disk_free) + " 2",
value = formatBytes(hostMetrics.diskfree2Bytes),
modifier = Modifier.fillMaxWidth(),
)
}
if (hostMetrics.hasDiskfree3Bytes()) {
LogLine(
label = stringResource(R.string.disk_free) + " 3",
value = formatBytes(hostMetrics.diskfree3Bytes),
modifier = Modifier.fillMaxWidth(),
)
}
LogLine(
label = stringResource(R.string.load) + " 1",
value = (hostMetrics.load1 / 100.0).toString(),
@ -186,6 +190,13 @@ fun HostMetricsItem(
trackColor = ProgressIndicatorDefaults.linearTrackColor,
strokeCap = ProgressIndicatorDefaults.LinearStrokeCap,
)
if (hostMetrics.hasUserString()) {
LogLine(
label = stringResource(R.string.user_string),
value = hostMetrics.userString,
modifier = Modifier.fillMaxWidth(),
)
}
}
}
}
@ -241,11 +252,12 @@ private fun HostMetricsItemPreview() {
.setUptimeSeconds(3600)
.setFreememBytes(2048000)
.setDiskfree1Bytes(104857600)
.setDiskfree2Bytes(209715200)
.setDiskfree2Bytes(2097915200)
.setDiskfree3Bytes(44444)
.setLoad1(30)
.setLoad5(75)
.setLoad15(19)
.setUserString("test")
.build()
val logs = TelemetryProtos.Telemetry.newBuilder()
.setTime((System.currentTimeMillis() / 1000L).toInt())

View file

@ -637,4 +637,5 @@
<string name="free_memory">Free Memory</string>
<string name="disk_free">Disk Free</string>
<string name="load">Load</string>
<string name="user_string">User String</string>
</resources>