Skip to content

Commit b719459

Browse files
authored
[receiver/k8s_cluster] move namespace to use pdata (open-telemetry#23437)
Switch k8s.namespace metrics to use pdata.
1 parent b2238b9 commit b719459

File tree

14 files changed

+647
-59
lines changed

14 files changed

+647
-59
lines changed

.chloggen/switchk8snamespace.yaml

Lines changed: 11 additions & 0 deletions
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.namespace metrics to use pdata.
9+
10+
# One or more tracking issues related to the change
11+
issues: [23437]

receiver/k8sclusterreceiver/internal/collection/collector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (dc *DataCollector) SyncMetrics(obj interface{}) {
108108
case *corev1.Node:
109109
md = ocsToMetrics(node.GetMetrics(o, dc.nodeConditionsToReport, dc.allocatableTypesToReport, dc.settings.TelemetrySettings.Logger))
110110
case *corev1.Namespace:
111-
md = ocsToMetrics(namespace.GetMetrics(o))
111+
md = namespace.GetMetrics(dc.settings, o)
112112
case *corev1.ReplicationController:
113113
md = ocsToMetrics(replicationcontroller.GetMetrics(o))
114114
case *corev1.ResourceQuota:
Lines changed: 6 additions & 0 deletions
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 namespace // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/namespace"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)
2+
3+
# k8s/namespace
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.namespace.phase
16+
17+
The current phase of namespaces (1 for active and 0 for terminating)
18+
19+
| Unit | Metric Type | Value Type |
20+
| ---- | ----------- | ---------- |
21+
| 1 | Gauge | Int |
22+
23+
## Resource Attributes
24+
25+
| Name | Description | Values | Enabled |
26+
| ---- | ----------- | ------ | ------- |
27+
| k8s.namespace.name | The k8s namespace name. | Any Str | true |
28+
| k8s.namespace.uid | The k8s namespace uid. | Any Str | true |
29+
| opencensus.resourcetype | The OpenCensus resource type. | Any Str | true |

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

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)