Skip to content

Commit

Permalink
fixup! fixup! Represent GVK information as labels
Browse files Browse the repository at this point in the history
  • Loading branch information
rexagod committed Oct 18, 2022
1 parent 7f906e8 commit 762f98b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
21 changes: 13 additions & 8 deletions docs/customresourcestate-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/customresourcestate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/customresourcestate/registry_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 762f98b

Please sign in to comment.