Skip to content

Commit

Permalink
Merge pull request kubernetes#23513 from rphillips/backports/80657
Browse files Browse the repository at this point in the history
UPSTREAM: 80657: add UID to kubelet_container_log_filesystem_used_bytes metric

Origin-commit: 287f1c883767f3407ffdc7c4a3cc614241df4645
  • Loading branch information
k8s-publishing-bot committed Jul 31, 2019
2 parents 9166b5c + be5f99c commit 0b3813e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/kubelet/metrics/collectors/log_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
"kubelet_container_log_filesystem_used_bytes",
"Bytes used by the container's logs on the filesystem.",
[]string{
"uid",
"namespace",
"pod",
"container",
Expand Down Expand Up @@ -67,6 +68,7 @@ func (c *logMetricsCollector) Collect(ch chan<- prometheus.Metric) {
descLogSize,
prometheus.GaugeValue,
float64(*c.Logs.UsedBytes),
ps.PodRef.UID,
ps.PodRef.Namespace,
ps.PodRef.Name,
c.Name,
Expand Down
3 changes: 2 additions & 1 deletion pkg/kubelet/metrics/collectors/log_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func TestMetricsCollected(t *testing.T) {
PodRef: statsapi.PodReference{
Namespace: "some-namespace",
Name: "podName1",
UID: "UID_some_id",
},
Containers: []statsapi.ContainerStats{
{
Expand All @@ -68,7 +69,7 @@ func TestMetricsCollected(t *testing.T) {
err := testutil.CollectAndCompare(collector, strings.NewReader(`
# HELP kubelet_container_log_filesystem_used_bytes Bytes used by the container's logs on the filesystem.
# TYPE kubelet_container_log_filesystem_used_bytes gauge
kubelet_container_log_filesystem_used_bytes{container="containerName1",namespace="some-namespace",pod="podName1"} 18
kubelet_container_log_filesystem_used_bytes{container="containerName1",namespace="some-namespace",pod="podName1",uid="UID_some_id"} 18
`), "kubelet_container_log_filesystem_used_bytes")
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 0b3813e

Please sign in to comment.