Merge pull request #80657 from rphillips/fixes/log_metrics_add_uid

kubelet: add UID to kubelet_container_log_filesystem_used_bytes metric
This commit is contained in:
Kubernetes Prow Robot 2019-07-30 08:53:43 -07:00 committed by GitHub
commit 4f15c017ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -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",
@ -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,

View File

@ -51,6 +51,7 @@ func TestMetricsCollected(t *testing.T) {
PodRef: statsapi.PodReference{
Namespace: "some-namespace",
Name: "podName1",
UID: "UID_some_id",
},
Containers: []statsapi.ContainerStats{
{
@ -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)