Skip to content

Commit dcfaae9

Browse files
committed
Add some info about 1:1/1:n relationships
1 parent 7ac9968 commit dcfaae9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

docs/design/metrics-best-practices.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ This way kube-state-metrics allows the user to have full control on how they wan
3131
### Static object properties
3232

3333
An object usually has a stable set of properties that do not change during its lifecycle in Kubernetes.
34-
This includes properties like name, namespace, uid etc.
34+
This includes properties like name, namespace, uid etc. that have a 1:1 relationship with the object.
3535
It is a good practice to group those together into an `_info` metric.
36+
If there is a 1:n relationship (e.g. a list of ports), it should be in a separate metric to avoid generating too many metrics.
3637

3738
### Dynamic object properties
3839

@@ -41,8 +42,6 @@ These change during the lifecycle of the object.
4142
For example a pod can be in different states like "Pending", "Running" etc.
4243
These should be part of a "State Set" that includes labels that identify the object as well as the dynamic property.
4344

44-
For example:
45-
4645
### Linked properties
4746

4847
If an object contains a substructure that links multiple properties together (e.g. endpoint address and port), those should be reported in the same metric.

0 commit comments

Comments
 (0)