mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +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",
|
"kubelet_container_log_filesystem_used_bytes",
|
||||||
"Bytes used by the container's logs on the filesystem.",
|
"Bytes used by the container's logs on the filesystem.",
|
||||||
[]string{
|
[]string{
|
||||||
|
"uid",
|
||||||
"namespace",
|
"namespace",
|
||||||
"pod",
|
"pod",
|
||||||
"container",
|
"container",
|
||||||
@ -67,6 +68,7 @@ func (c *logMetricsCollector) Collect(ch chan<- prometheus.Metric) {
|
|||||||
descLogSize,
|
descLogSize,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(*c.Logs.UsedBytes),
|
float64(*c.Logs.UsedBytes),
|
||||||
|
ps.PodRef.UID,
|
||||||
ps.PodRef.Namespace,
|
ps.PodRef.Namespace,
|
||||||
ps.PodRef.Name,
|
ps.PodRef.Name,
|
||||||
c.Name,
|
c.Name,
|
||||||
|
@ -51,6 +51,7 @@ func TestMetricsCollected(t *testing.T) {
|
|||||||
PodRef: statsapi.PodReference{
|
PodRef: statsapi.PodReference{
|
||||||
Namespace: "some-namespace",
|
Namespace: "some-namespace",
|
||||||
Name: "podName1",
|
Name: "podName1",
|
||||||
|
UID: "UID_some_id",
|
||||||
},
|
},
|
||||||
Containers: []statsapi.ContainerStats{
|
Containers: []statsapi.ContainerStats{
|
||||||
{
|
{
|
||||||
@ -68,7 +69,7 @@ func TestMetricsCollected(t *testing.T) {
|
|||||||
err := testutil.CollectAndCompare(collector, strings.NewReader(`
|
err := testutil.CollectAndCompare(collector, strings.NewReader(`
|
||||||
# HELP kubelet_container_log_filesystem_used_bytes Bytes used by the container's logs on the filesystem.
|
# 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
|
# 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")
|
`), "kubelet_container_log_filesystem_used_bytes")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user