diff --git a/docs/customresourcestate-metrics.md b/docs/customresourcestate-metrics.md index b16ddf7a0e..7baaa58231 100644 --- a/docs/customresourcestate-metrics.md +++ b/docs/customresourcestate-metrics.md @@ -116,7 +116,7 @@ spec: Produces the metric: ```prometheus -kube_uptime{group="myteam.io", kind="Foo", version="v1"} 43.21 +kube_crd_uptime{group="myteam.io", kind="Foo", version="v1"} 43.21 ``` #### Multiple Metrics/Kitchen Sink @@ -167,8 +167,8 @@ spec: Produces the following metrics: ```prometheus -kube_active_count{group="myteam.io", kind="Foo", version="v1", active="1",custom_metric="yes",foo="bar",name="foo",bar="baz",qux="quxx",type="type-a"} 1 -kube_active_count{group="myteam.io", kind="Foo", version="v1", active="3",custom_metric="yes",foo="bar",name="foo",bar="baz",qux="quxx",type="type-b"} 3 +kube_crd_active_count{group="myteam.io", kind="Foo", version="v1", active="1",custom_metric="yes",foo="bar",name="foo",bar="baz",qux="quxx",type="type-a"} 1 +kube_crd_active_count{group="myteam.io", kind="Foo", version="v1", active="3",custom_metric="yes",foo="bar",name="foo",bar="baz",qux="quxx",type="type-b"} 3 ``` ### Metric types @@ -203,7 +203,7 @@ spec: Produces the metric: ```prometheus -kube_uptime{group="myteam.io", kind="Foo", version="v1"} 43.21 +kube_crd_uptime{group="myteam.io", kind="Foo", version="v1"} 43.21 ``` #### StateSet @@ -235,9 +235,9 @@ The value will be 1, if the value matches the one in list. Produces the metric: ```prometheus -kube_status_phase{group="myteam.io", kind="Foo", version="v1", phase="Pending"} 1 -kube_status_phase{group="myteam.io", kind="Foo", version="v1", phase="Bar"} 0 -kube_status_phase{group="myteam.io", kind="Foo", version="v1", phase="Baz"} 0 +kube_crd_status_phase{group="myteam.io", kind="Foo", version="v1", phase="Pending"} 1 +kube_crd_status_phase{group="myteam.io", kind="Foo", version="v1", phase="Bar"} 0 +kube_crd_status_phase{group="myteam.io", kind="Foo", version="v1", phase="Baz"} 0 ``` #### Info @@ -267,7 +267,7 @@ spec: Produces the metric: ```prometheus -kube_version{group="myteam.io", kind="Foo", version="v1", version="v1.2.3"} 1 +kube_crd_version{group="myteam.io", kind="Foo", version="v1", version="v1.2.3"} 1 ``` ### Naming @@ -305,6 +305,11 @@ spec: ... ``` +Produces: +```prometheus +uptime{group="myteam.io", kind="Foo", version="v1"} 43.21 +``` + ### Logging If a metric path is registered but not found on a custom resource, an error will be logged. For some resources, diff --git a/pkg/customresourcestate/config.go b/pkg/customresourcestate/config.go index 19b2dbb073..288c1e90b3 100644 --- a/pkg/customresourcestate/config.go +++ b/pkg/customresourcestate/config.go @@ -64,7 +64,7 @@ type Resource struct { func (r Resource) GetMetricNamePrefix() string { p := r.MetricNamePrefix if p == nil { - return "kube" + return "kube_crd" } return *p } diff --git a/pkg/customresourcestate/registry_factory_test.go b/pkg/customresourcestate/registry_factory_test.go index 67434b2222..1c05cd55ce 100644 --- a/pkg/customresourcestate/registry_factory_test.go +++ b/pkg/customresourcestate/registry_factory_test.go @@ -324,7 +324,7 @@ func Test_fullName(t *testing.T) { resource: r(nil), f: count, }, - want: "kube_count", + want: "kube_crd_count", }, { name: "no prefix",