From 7321d16dc7b8b9ca5c717836c2460921cb7ba289 Mon Sep 17 00:00:00 2001 From: Nick Neisen Date: Wed, 16 May 2018 18:52:50 -0600 Subject: [PATCH 1/2] Update documentation for RingLogger's ring buffer Signed-off-by: Nick Neisen Upstream-commit: 3521d534e5c9338ae5605d1228554862e922a8a9 Component: engine --- components/engine/daemon/logger/ring.go | 2 +- components/engine/daemon/logger/ring_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/engine/daemon/logger/ring.go b/components/engine/daemon/logger/ring.go index 887f2ea18a..c675c1e83c 100644 --- a/components/engine/daemon/logger/ring.go +++ b/components/engine/daemon/logger/ring.go @@ -150,7 +150,7 @@ func newRing(maxBytes int64) *messageRing { } // Enqueue adds a message to the buffer queue -// If the message is too big for the buffer it drops the oldest messages to make room +// If the message is too big for the buffer it drops the new message. // If there are no messages in the queue and the message is still too big, it adds the message anyway. func (r *messageRing) Enqueue(m *Message) error { mSize := int64(len(m.Line)) diff --git a/components/engine/daemon/logger/ring_test.go b/components/engine/daemon/logger/ring_test.go index e774535fee..a2289cc667 100644 --- a/components/engine/daemon/logger/ring_test.go +++ b/components/engine/daemon/logger/ring_test.go @@ -58,7 +58,7 @@ func TestRingCap(t *testing.T) { } } - // should have messages in the queue for "5" to "10" + // should have messages in the queue for "0" to "4" for i := 0; i < 5; i++ { m, err := r.Dequeue() if err != nil { From 17b1295241a0bed42b5809fdf88a70d343134caa Mon Sep 17 00:00:00 2001 From: AJ Bowen Date: Sun, 5 Nov 2017 10:12:34 -0800 Subject: [PATCH 2/2] Highlight meaning of 'precpu' (i.e. 'previous'). Signed-off-by: AJ Bowen Signed-off-by: Vincent Demeester Signed-off-by: Sebastiaan van Stijn Upstream-commit: b7fe0b6359dcbefd269c13ee4649d9247539cd18 Component: engine --- components/engine/api/swagger.yaml | 6 +++--- components/engine/docs/api/v1.19.md | 2 +- components/engine/docs/api/v1.20.md | 2 +- components/engine/docs/api/v1.21.md | 2 +- components/engine/docs/api/v1.22.md | 2 +- components/engine/docs/api/v1.23.md | 2 +- components/engine/docs/api/v1.24.md | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/engine/api/swagger.yaml b/components/engine/api/swagger.yaml index cf7043d336..a21d345704 100644 --- a/components/engine/api/swagger.yaml +++ b/components/engine/api/swagger.yaml @@ -5095,9 +5095,9 @@ paths: This endpoint returns a live stream of a container’s resource usage statistics. - The `precpu_stats` is the CPU statistic of last read, which is used - for calculating the CPU usage percentage. It is not the same as the - `cpu_stats` field. + The `precpu_stats` is the CPU statistic of the *previous* read, and is + used to calculate the CPU usage percentage. It is not an exact copy + of the `cpu_stats` field. If either `precpu_stats.online_cpus` or `cpu_stats.online_cpus` is nil then for compatibility with older daemons the length of the diff --git a/components/engine/docs/api/v1.19.md b/components/engine/docs/api/v1.19.md index 448fe832ef..f3d44555a5 100644 --- a/components/engine/docs/api/v1.19.md +++ b/components/engine/docs/api/v1.19.md @@ -739,7 +739,7 @@ This endpoint returns a live stream of a container's resource usage statistics. } } -The `precpu_stats` is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. +The `precpu_stats` is the cpu statistic of *previous* read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. **Query parameters**: diff --git a/components/engine/docs/api/v1.20.md b/components/engine/docs/api/v1.20.md index b971bab4be..199428121b 100644 --- a/components/engine/docs/api/v1.20.md +++ b/components/engine/docs/api/v1.20.md @@ -748,7 +748,7 @@ This endpoint returns a live stream of a container's resource usage statistics. } } -The `precpu_stats` is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. +The `precpu_stats` is the cpu statistic of *previous* read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. **Query parameters**: diff --git a/components/engine/docs/api/v1.21.md b/components/engine/docs/api/v1.21.md index 2971d25c45..3ecfd3b9f9 100644 --- a/components/engine/docs/api/v1.21.md +++ b/components/engine/docs/api/v1.21.md @@ -829,7 +829,7 @@ This endpoint returns a live stream of a container's resource usage statistics. } } -The `precpu_stats` is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. +The `precpu_stats` is the cpu statistic of *previous* read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. **Query parameters**: diff --git a/components/engine/docs/api/v1.22.md b/components/engine/docs/api/v1.22.md index a51fbcb7de..fc19c9f0af 100644 --- a/components/engine/docs/api/v1.22.md +++ b/components/engine/docs/api/v1.22.md @@ -957,7 +957,7 @@ This endpoint returns a live stream of a container's resource usage statistics. } } -The `precpu_stats` is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. +The `precpu_stats` is the cpu statistic of *previous* read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. **Query parameters**: diff --git a/components/engine/docs/api/v1.23.md b/components/engine/docs/api/v1.23.md index 677dcab789..218734aea6 100644 --- a/components/engine/docs/api/v1.23.md +++ b/components/engine/docs/api/v1.23.md @@ -986,7 +986,7 @@ This endpoint returns a live stream of a container's resource usage statistics. } } -The `precpu_stats` is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. +The `precpu_stats` is the cpu statistic of *previous* read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. **Query parameters**: diff --git a/components/engine/docs/api/v1.24.md b/components/engine/docs/api/v1.24.md index a32325e2d9..e320020ed6 100644 --- a/components/engine/docs/api/v1.24.md +++ b/components/engine/docs/api/v1.24.md @@ -1036,7 +1036,7 @@ This endpoint returns a live stream of a container's resource usage statistics. } } -The `precpu_stats` is the cpu statistic of last read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. +The `precpu_stats` is the cpu statistic of *previous* read, which is used for calculating the cpu usage percent. It is not the exact copy of the `cpu_stats` field. **Query parameters**: