diff --git a/docs/lease-metrics.md b/docs/lease-metrics.md
index a65e7ce8d2..209aeea59a 100644
--- a/docs/lease-metrics.md
+++ b/docs/lease-metrics.md
@@ -3,4 +3,4 @@
| Metric name| Metric type | Labels/tags | Status |
| ---------- | ----------- |-------------------------------------------------------------------------------------------------------------------------------------------| ----------- |
| kube_lease_owner | Gauge | `lease`=<lease-name>
`owner_kind`=<onwer kind>
`owner_name`=<owner name>
`namespace` = <namespace> | EXPERIMENTAL |
-| kube_lease_renew_time | Gauge | `lease`=<lease-name>
`namespace` = <namespace> | EXPERIMENTAL |
+| kube_lease_renew_time | Gauge | `lease`=<lease-name> | EXPERIMENTAL |
diff --git a/internal/store/lease.go b/internal/store/lease.go
index f7031147b9..9ae44f5c7e 100644
--- a/internal/store/lease.go
+++ b/internal/store/lease.go
@@ -40,7 +40,7 @@ var (
metric.Gauge,
"",
wrapLeaseFunc(func(l *coordinationv1.Lease) *metric.Family {
- labelKeys := []string{"owner_kind", "owner_name"}
+ labelKeys := []string{"owner_kind", "owner_name", "namespace"}
owners := l.GetOwnerReferences()
if len(owners) == 0 {
@@ -48,7 +48,7 @@ var (
Metrics: []*metric.Metric{
{
LabelKeys: labelKeys,
- LabelValues: []string{"", ""},
+ LabelValues: []string{"", "", l.Namespace},
Value: 1,
},
},
@@ -59,7 +59,7 @@ var (
for i, owner := range owners {
ms[i] = &metric.Metric{
LabelKeys: labelKeys,
- LabelValues: []string{owner.Kind, owner.Name},
+ LabelValues: []string{owner.Kind, owner.Name, l.Namespace},
Value: 1,
}
}
diff --git a/internal/store/lease_test.go b/internal/store/lease_test.go
index 30bfce51d7..743cd944c6 100644
--- a/internal/store/lease_test.go
+++ b/internal/store/lease_test.go
@@ -41,6 +41,7 @@ func TestLeaseStore(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
Generation: 2,
Name: "kube-master",
+ Namespace: "default",
CreationTimestamp: metav1.Time{Time: time.Unix(1500000000, 0)},
OwnerReferences: []metav1.OwnerReference{
{
@@ -54,7 +55,7 @@ func TestLeaseStore(t *testing.T) {
},
},
Want: metadata + `
- kube_lease_owner{lease="kube-master",owner_kind="Node",owner_name="kube-master"} 1
+ kube_lease_owner{lease="kube-master",owner_kind="Node",owner_name="kube-master",namespace="default"} 1
kube_lease_renew_time{lease="kube-master"} 1.5e+09
`,
MetricNames: []string{