Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3323a08134 |
No files matched your search
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
<img src="https://raw.githubusercontent.com/homarr-labs/charts/refs/heads/main/charts/homarr/icon.svg" align="right" width="92" alt="homarr logo">
|
<img src="https://raw.githubusercontent.com/homarr-labs/charts/refs/heads/main/charts/homarr/icon.svg" align="right" width="92" alt="homarr logo">
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
A Helm chart to deploy homarr for Kubernetes
|
A Helm chart to deploy homarr for Kubernetes
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ All available values are listed on the [artifacthub](https://artifacthub.io/pack
|
|||||||
| httproute.rules[0].matches[0].path.value | string | `"/"` | Path value to match |
|
| httproute.rules[0].matches[0].path.value | string | `"/"` | Path value to match |
|
||||||
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
|
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
|
||||||
| image.repository | string | `"ghcr.io/homarr-labs/homarr"` | Image repository |
|
| image.repository | string | `"ghcr.io/homarr-labs/homarr"` | Image repository |
|
||||||
| image.tag | string | `"v1.76.1"` | Overrides the image tag whose default is the chart appVersion |
|
| image.tag | string | `"v1.76.2"` | Overrides the image tag whose default is the chart appVersion |
|
||||||
| imagePullSecrets | list | `[]` | Secrets for Docker registry |
|
| imagePullSecrets | list | `[]` | Secrets for Docker registry |
|
||||||
| ingress.annotations | object | `{}` | Ingress annotations |
|
| ingress.annotations | object | `{}` | Ingress annotations |
|
||||||
| ingress.enabled | bool | `false` | Enable ingress |
|
| ingress.enabled | bool | `false` | Enable ingress |
|
||||||
|
|||||||
@@ -481,14 +481,13 @@ export function calculateCpuUsage(stats: ContainerStats): number {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cpuDelta = stats.cpu_stats.cpu_usage.total_usage - (stats.precpu_stats?.cpu_usage?.total_usage ?? 0);
|
const numberOfCpus = stats.cpu_stats.online_cpus;
|
||||||
const systemDelta = (stats.cpu_stats.system_cpu_usage ?? 0) - (stats.precpu_stats?.system_cpu_usage ?? 0);
|
const usage = stats.cpu_stats.system_cpu_usage;
|
||||||
|
if (!usage || usage === 0) {
|
||||||
if (systemDelta <= 0 || cpuDelta < 0) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (cpuDelta / systemDelta) * 100;
|
return (stats.cpu_stats.cpu_usage.total_usage / usage) * numberOfCpus * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateMemoryUsage(stats: ContainerStats): number {
|
export function calculateMemoryUsage(stats: ContainerStats): number {
|
||||||
|
|||||||
@@ -72,16 +72,16 @@ describe("calculateCpuUsage", () => {
|
|||||||
const stats = createStats({
|
const stats = createStats({
|
||||||
cpu_stats: { online_cpus: 4, cpu_usage: { total_usage: 2000 }, system_cpu_usage: 10000 },
|
cpu_stats: { online_cpus: 4, cpu_usage: { total_usage: 2000 }, system_cpu_usage: 10000 },
|
||||||
});
|
});
|
||||||
// (2000 / 10000) * 100 = 20
|
// (2000 / 10000) * 4 * 100 = 80
|
||||||
expect(calculateCpuUsage(stats)).toBe(20);
|
expect(calculateCpuUsage(stats)).toBe(80);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should handle fractional CPU usage", () => {
|
test("should handle fractional CPU usage", () => {
|
||||||
const stats = createStats({
|
const stats = createStats({
|
||||||
cpu_stats: { online_cpus: 2, cpu_usage: { total_usage: 500 }, system_cpu_usage: 100000 },
|
cpu_stats: { online_cpus: 2, cpu_usage: { total_usage: 500 }, system_cpu_usage: 100000 },
|
||||||
});
|
});
|
||||||
// (500 / 100000) * 100 = 0.5
|
// (500 / 100000) * 2 * 100 = 1
|
||||||
expect(calculateCpuUsage(stats)).toBe(0.5);
|
expect(calculateCpuUsage(stats)).toBe(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user