Signed-off-by: Velko Ivanov <vivanov@deeperplane.com>
| ... | ... |
@@ -5994,6 +5994,16 @@ paths: |
| 5994 | 5994 |
* `cpu_stats`: `cpu_usage.percpu_usage` |
| 5995 | 5995 |
* `memory_stats`: `max_usage` and `failcnt` |
| 5996 | 5996 |
Also, `memory_stats.stats` fields are incompatible with cgroup v1. |
| 5997 |
+ |
|
| 5998 |
+ To calculate the values shown by the `stats` command of the docker cli tool |
|
| 5999 |
+ the following formulas can be used: |
|
| 6000 |
+ * used_memory = `memory_stats.usage - memory_stats.stats.cache` |
|
| 6001 |
+ * available_memory = `memory_stats.limit` |
|
| 6002 |
+ * Memory usage % = `(used_memory / available_memory) * 100.0` |
|
| 6003 |
+ * cpu_delta = `cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage` |
|
| 6004 |
+ * system_cpu_delta = `cpu_stats.system_cpu_usage - precpu_stats.system_cpu_usage` |
|
| 6005 |
+ * number_cpus = `lenght(cpu_stats.cpu_usage.percpu_usage)` or `cpu_stats.online_cpus` |
|
| 6006 |
+ * CPU usage % = `(cpu_delta / system_cpu_delta) * number_cpus * 100.0` |
|
| 5997 | 6007 |
operationId: "ContainerStats" |
| 5998 | 6008 |
produces: ["application/json"] |
| 5999 | 6009 |
responses: |