mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
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:
commit
4f15c017ea
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user