Skip to content

Commit 6ee548b

Browse files
authored
[receiver/k8s_cluster] move node metrics to pdata (open-telemetry#23438)
Switch k8s.node metrics to use pdata.
1 parent 5fff104 commit 6ee548b

File tree

16 files changed

+1448
-132
lines changed

16 files changed

+1448
-132
lines changed

.chloggen/switchk8snode.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: enhancement
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
5+
component: k8sclusterreceiver
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Switch k8s.node metrics to use pdata.
9+
10+
# One or more tracking issues related to the change
11+
issues: [23438]

receiver/k8sclusterreceiver/go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ require (
66
github.com/census-instrumentation/opencensus-proto v0.4.1
77
github.com/google/go-cmp v0.5.9
88
github.com/google/uuid v1.3.0
9-
github.com/iancoleman/strcase v0.2.0
109
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.79.0
1110
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.79.0
1211
github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.79.0

receiver/k8sclusterreceiver/go.sum

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/k8sclusterreceiver/internal/collection/collector.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (dc *DataCollector) SyncMetrics(obj interface{}) {
106106
case *corev1.Pod:
107107
md = ocsToMetrics(pod.GetMetrics(o, dc.settings.TelemetrySettings.Logger))
108108
case *corev1.Node:
109-
md = ocsToMetrics(node.GetMetrics(o, dc.nodeConditionsToReport, dc.allocatableTypesToReport, dc.settings.TelemetrySettings.Logger))
109+
md = node.GetMetrics(dc.settings, o, dc.nodeConditionsToReport, dc.allocatableTypesToReport)
110110
case *corev1.Namespace:
111111
md = namespace.GetMetrics(dc.settings, o)
112112
case *corev1.ReplicationController:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//go:generate mdatagen metadata.yaml
5+
6+
package node // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/node"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)
2+
3+
# k8s/node
4+
5+
## Default Metrics
6+
7+
The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:
8+
9+
```yaml
10+
metrics:
11+
<metric_name>:
12+
enabled: false
13+
```
14+
15+
### k8s.node.allocatable_cpu
16+
17+
How many CPU cores remaining that the node can allocate to pods
18+
19+
| Unit | Metric Type | Value Type |
20+
| ---- | ----------- | ---------- |
21+
| {cores} | Gauge | Double |
22+
23+
### k8s.node.allocatable_ephemeral_storage
24+
25+
How many bytes of ephemeral storage remaining that the node can allocate to pods
26+
27+
| Unit | Metric Type | Value Type |
28+
| ---- | ----------- | ---------- |
29+
| By | Gauge | Int |
30+
31+
### k8s.node.allocatable_memory
32+
33+
How many bytes of RAM memory remaining that the node can allocate to pods
34+
35+
| Unit | Metric Type | Value Type |
36+
| ---- | ----------- | ---------- |
37+
| By | Gauge | Int |
38+
39+
### k8s.node.allocatable_storage
40+
41+
How many bytes of storage remaining that the node can allocate to pods
42+
43+
| Unit | Metric Type | Value Type |
44+
| ---- | ----------- | ---------- |
45+
| By | Gauge | Int |
46+
47+
### k8s.node.condition_disk_pressure
48+
49+
Whether this node is DiskPressure (1), not DiskPressure (0) or in an unknown state (-1)
50+
51+
| Unit | Metric Type | Value Type |
52+
| ---- | ----------- | ---------- |
53+
| 1 | Gauge | Int |
54+
55+
### k8s.node.condition_memory_pressure
56+
57+
Whether this node is MemoryPressure (1), not MemoryPressure (0) or in an unknown state (-1)
58+
59+
| Unit | Metric Type | Value Type |
60+
| ---- | ----------- | ---------- |
61+
| 1 | Gauge | Int |
62+
63+
### k8s.node.condition_network_unavailable
64+
65+
Whether this node is NetworkUnavailable (1), not NetworkUnavailable (0) or in an unknown state (-1)
66+
67+
| Unit | Metric Type | Value Type |
68+
| ---- | ----------- | ---------- |
69+
| 1 | Gauge | Int |
70+
71+
### k8s.node.condition_pid_pressure
72+
73+
Whether this node is PidPressure (1), not PidPressure (0) or in an unknown state (-1)
74+
75+
| Unit | Metric Type | Value Type |
76+
| ---- | ----------- | ---------- |
77+
| 1 | Gauge | Int |
78+
79+
### k8s.node.condition_ready
80+
81+
Whether this node is Ready (1), not Ready (0) or in an unknown state (-1)
82+
83+
| Unit | Metric Type | Value Type |
84+
| ---- | ----------- | ---------- |
85+
| 1 | Gauge | Int |
86+
87+
## Resource Attributes
88+
89+
| Name | Description | Values | Enabled |
90+
| ---- | ----------- | ------ | ------- |
91+
| k8s.node.name | The k8s node name. | Any Str | true |
92+
| k8s.node.uid | The k8s node uid. | Any Str | true |
93+
| opencensus.resourcetype | The OpenCensus resource type. | Any Str | true |

receiver/k8sclusterreceiver/internal/node/internal/metadata/generated_config.go

+108
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/k8sclusterreceiver/internal/node/internal/metadata/generated_config_test.go

+86
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)