Skip to content

Commit 4a3fd33

Browse files
jaehanbyunChrsMark
andauthored
[chore] document metrics for allocatable_types_to_report setting (#42539)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Document the metrics produced by the `allocatable_types_to_report` setting in the k8scluster receiver. - Add an explicit table mapping allocatable types to metric names in README. - Clarify that `storage` is not part of Kubernetes Node Allocatable and remove it from the listed types. - https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable - Add a reference to Kubernetes Node Allocatable docs for clarity. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #42311 <!--Describe what testing was performed and which tests were added.--> #### Testing Deployed `opentelemetry-collector-contrib` v0.133.0 via the official Helm chart(`mode=deployment`, `presets.clusterMetrics=true`) and enabled allocatable metrics in the `k8s_cluster` receiver as follows: ```yaml config: receivers: k8s_cluster: auth_type: serviceAccount collection_interval: 30s allocatable_types_to_report: - cpu - memory - ephemeral-storage - storage - pods exporters: prometheus: endpoint: "0.0.0.0:8889" ``` With this configuration, the following metrics were observed on /metrics: ``` # HELP k8s_node_allocatable_cpu Amount of cpu allocatable on the node # TYPE k8s_node_allocatable_cpu gauge k8s_node_allocatable_cpu{otel_scope_name="github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver",otel_scope_schema_url="",otel_scope_version="0.133.0"} 1.93 # HELP k8s_node_allocatable_ephemeral_storage_bytes Amount of ephemeral-storage allocatable on the node # TYPE k8s_node_allocatable_ephemeral_storage_bytes gauge k8s_node_allocatable_ephemeral_storage_bytes{otel_scope_name="github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver",otel_scope_schema_url="",otel_scope_version="0.133.0"} 7.6224326324e+10 # HELP k8s_node_allocatable_memory_bytes Amount of memory allocatable on the node # TYPE k8s_node_allocatable_memory_bytes gauge k8s_node_allocatable_memory_bytes{otel_scope_name="github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver",otel_scope_schema_url="",otel_scope_version="0.133.0"} 5.54446848e+08 # HELP k8s_node_allocatable_pods Amount of pods allocatable on the node # TYPE k8s_node_allocatable_pods gauge k8s_node_allocatable_pods{otel_scope_name="github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver",otel_scope_schema_url="",otel_scope_version="0.133.0"} 4 ``` <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.--> Signed-off-by: jaehanbyun <[email protected]> Co-authored-by: Christos Markou <[email protected]>
1 parent 7b83ee5 commit 4a3fd33

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

receiver/k8sclusterreceiver/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,21 @@ by the cluster. Currently supported versions are `kubernetes` and `openshift`. S
5454
the value to `openshift` enables OpenShift specific metrics in addition to standard
5555
kubernetes ones.
5656
- `allocatable_types_to_report` (default = `[]`): An array of allocatable resource types this receiver should report.
57-
The following allocatable resource types are available.
57+
The following allocatable resource types are available (see Node Allocatable in [Kubernetes docs](https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable)):
5858
- cpu
5959
- memory
6060
- ephemeral-storage
61-
- storage
6261
- pods
62+
63+
When enabled, this setting produces the following node-level metrics (one per selected type):
64+
65+
| allocatable type | metric name | unit | type | value type |
66+
| ---------------- | -------------------------------- | -------- | ----- | ---------- |
67+
| cpu | k8s.node.allocatable_cpu | {cpu} | Gauge | Double |
68+
| memory | k8s.node.allocatable_memory | By | Gauge | Double |
69+
| ephemeral-storage| k8s.node.allocatable_ephemeral_storage | By | Gauge | Double |
70+
| pods | k8s.node.allocatable_pods | {pod} | Gauge | Int |
71+
6372
- `metrics`: Allows to enable/disable metrics.
6473
- `resource_attributes`: Allows to enable/disable resource attributes.
6574
- `namespace` (deprecated, use `namespaces` instead): Allows to observe resources for a particular namespace only. If this option is set to a non-empty string, `Nodes`, `Namespaces` and `ClusterResourceQuotas` will not be observed.

receiver/k8sclusterreceiver/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type Config struct {
2424
// here: https://kubernetes.io/docs/concepts/architecture/nodes/#condition.
2525
NodeConditionTypesToReport []string `mapstructure:"node_conditions_to_report"`
2626
// Allocate resource types to report. See all resource types, see
27-
// here: https://kubernetes.io/docs/concepts/architecture/nodes/#capacity
27+
// here: https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable
2828
AllocatableTypesToReport []string `mapstructure:"allocatable_types_to_report"`
2929
// List of exporters to which metadata from this receiver should be forwarded to.
3030
MetadataExporters []string `mapstructure:"metadata_exporters"`

0 commit comments

Comments
 (0)