Skip to content

Commit 2e11f46

Browse files
authored
[receiver/k8s_cluster] Move statefulset metrics to use pdata (open-telemetry#23420)
1 parent 5cfcdeb commit 2e11f46

File tree

12 files changed

+935
-104
lines changed

12 files changed

+935
-104
lines changed

.chloggen/switchk8sss.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.ss metrics to use pdata.
9+
10+
# One or more tracking issues related to the change
11+
issues: [23420]

receiver/k8sclusterreceiver/internal/collection/collector.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (dc *DataCollector) SyncMetrics(obj interface{}) {
120120
case *appsv1.DaemonSet:
121121
md = ocsToMetrics(demonset.GetMetrics(o))
122122
case *appsv1.StatefulSet:
123-
md = ocsToMetrics(statefulset.GetMetrics(o))
123+
md = statefulset.GetMetrics(dc.settings, o)
124124
case *batchv1.Job:
125125
md = ocsToMetrics(jobs.GetMetrics(o))
126126
case *batchv1.CronJob:
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 statefulset // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/statefulset"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)
2+
3+
# k8s/statefulset
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.statefulset.current_pods
16+
17+
The number of pods created by the StatefulSet controller from the StatefulSet version
18+
19+
| Unit | Metric Type | Value Type |
20+
| ---- | ----------- | ---------- |
21+
| 1 | Gauge | Int |
22+
23+
### k8s.statefulset.desired_pods
24+
25+
Number of desired pods in the stateful set (the `spec.replicas` field)
26+
27+
| Unit | Metric Type | Value Type |
28+
| ---- | ----------- | ---------- |
29+
| 1 | Gauge | Int |
30+
31+
### k8s.statefulset.ready_pods
32+
33+
Number of pods created by the stateful set that have the `Ready` condition
34+
35+
| Unit | Metric Type | Value Type |
36+
| ---- | ----------- | ---------- |
37+
| 1 | Gauge | Int |
38+
39+
### k8s.statefulset.updated_pods
40+
41+
Number of pods created by the StatefulSet controller from the StatefulSet version
42+
43+
| Unit | Metric Type | Value Type |
44+
| ---- | ----------- | ---------- |
45+
| 1 | Gauge | Int |
46+
47+
## Resource Attributes
48+
49+
| Name | Description | Values | Enabled |
50+
| ---- | ----------- | ------ | ------- |
51+
| k8s.namespace.name | The name of the namespace that the pod is running in. | Any Str | true |
52+
| k8s.statefulset.name | The k8s statefulset name. | Any Str | true |
53+
| k8s.statefulset.uid | The k8s statefulset uid. | Any Str | true |
54+
| opencensus.resourcetype | The OpenCensus resource type. | Any Str | true |

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

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

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

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

0 commit comments

Comments
 (0)