Skip to content

Commit 2f0f67b

Browse files
authored
Merge pull request #5361 from dashpole/update_naming_guidelines
Add exception for metric component prefixes for object metrics
2 parents b0f953d + e984f3b commit 2f0f67b

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

contributors/devel/sig-instrumentation/instrumentation.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,34 @@ requests.
116116
Resource objects that occur in names should inherit the spelling that is used
117117
in kubectl, i.e. daemon sets are `daemonset` rather than `daemon_set`.
118118

119+
### Exception for object state metrics
120+
121+
One exception to the component prefix rule is for metrics derived from
122+
the state of Kubernetes objects. From the users' perspective, controllers are an
123+
implementation detail of object reconciliation. The collection of controllers
124+
which comprise a working Kubernetes cluster is viewed as a single system which
125+
drives objects towards their specified desired state. Metrics concerning a
126+
given object should be easily discoverable and comparable even when they are
127+
produced by different controllers. Metrics describing the state of a built-in
128+
Kubernetes object take the form:
129+
130+
```
131+
kube_<kind>_<metric>
132+
```
133+
134+
Metrics describing the state of a custom resource avoids collisions by adding a
135+
group. Metrics take the form:
136+
137+
```
138+
kube_[<group>](https://kubernetes.io/docs/reference/using-api/#api-groups)_<kind>_metric
139+
```
140+
141+
The [Kube-State-Metrics](https://github.com/kubernetes/kube-state-metrics)
142+
project introduced the original kube_* prefixed metrics. For examples of
143+
kube_* prefixed metrics, refer to the list of
144+
[Exposed Metrics](https://github.com/kubernetes/kube-state-metrics/tree/master/docs#exposed-metrics)
145+
in the Kube-State-Metrics documentation.
146+
119147
## Dimensionality & Cardinality
120148

121149
Metrics can often replace more expensive logging as they are time-aggregated
@@ -213,4 +241,3 @@ metric could look as follows:
213241
```
214242
kube_pod_restarts and on(namespace, pod) kube_pod_info{uuid=”ABC”}
215243
```
216-

0 commit comments

Comments
 (0)