diff --git a/.chloggen/k8sclusterreceiver-opencensus.yaml b/.chloggen/k8sclusterreceiver-opencensus.yaml new file mode 100755 index 000000000000..1a1db9205460 --- /dev/null +++ b/.chloggen/k8sclusterreceiver-opencensus.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: k8sclusterreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Remove opencensus.resourcetype resource attribute" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [26487] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/receiver/k8sclusterreceiver/documentation.md b/receiver/k8sclusterreceiver/documentation.md index 1f2cbf8f2bf6..15acf9331c1f 100644 --- a/receiver/k8sclusterreceiver/documentation.md +++ b/receiver/k8sclusterreceiver/documentation.md @@ -438,6 +438,5 @@ Current status reason of the pod (1 - Evicted, 2 - NodeAffinity, 3 - NodeLost, 4 | k8s.resourcequota.uid | The k8s resourcequota uid. | Any Str | true | | k8s.statefulset.name | The k8s statefulset name. | Any Str | true | | k8s.statefulset.uid | The k8s statefulset uid. | Any Str | true | -| opencensus.resourcetype | The OpenCensus resource type. | Any Str | false | | openshift.clusterquota.name | The k8s ClusterResourceQuota name. | Any Str | true | | openshift.clusterquota.uid | The k8s ClusterResourceQuota uid. | Any Str | true | diff --git a/receiver/k8sclusterreceiver/internal/clusterresourcequota/clusterresourcequotas.go b/receiver/k8sclusterreceiver/internal/clusterresourcequota/clusterresourcequotas.go index f2d90593f064..76afaf001700 100644 --- a/receiver/k8sclusterreceiver/internal/clusterresourcequota/clusterresourcequotas.go +++ b/receiver/k8sclusterreceiver/internal/clusterresourcequota/clusterresourcequotas.go @@ -40,7 +40,6 @@ func RecordMetrics(mb *metadata.MetricsBuilder, crq *quotav1.ClusterResourceQuot rb := mb.NewResourceBuilder() rb.SetOpenshiftClusterquotaName(crq.Name) rb.SetOpenshiftClusterquotaUID(string(crq.UID)) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(metadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/container/containers.go b/receiver/k8sclusterreceiver/internal/container/containers.go index 53eb807b2e18..9879d9ca71a6 100644 --- a/receiver/k8sclusterreceiver/internal/container/containers.go +++ b/receiver/k8sclusterreceiver/internal/container/containers.go @@ -77,7 +77,6 @@ func RecordSpecMetrics(logger *zap.Logger, mb *imetadata.MetricsBuilder, c corev rb.SetK8sPodName(pod.Name) rb.SetK8sNodeName(pod.Spec.NodeName) rb.SetK8sNamespaceName(pod.Namespace) - rb.SetOpencensusResourcetype("container") rb.SetContainerID(utils.StripContainerID(containerID)) rb.SetK8sContainerName(c.Name) image, err := docker.ParseImageName(imageStr) diff --git a/receiver/k8sclusterreceiver/internal/cronjob/cronjobs.go b/receiver/k8sclusterreceiver/internal/cronjob/cronjobs.go index f514192d65cf..844a3fe452e7 100644 --- a/receiver/k8sclusterreceiver/internal/cronjob/cronjobs.go +++ b/receiver/k8sclusterreceiver/internal/cronjob/cronjobs.go @@ -25,7 +25,6 @@ func RecordMetrics(mb *metadata.MetricsBuilder, cj *batchv1.CronJob, ts pcommon. rb.SetK8sNamespaceName(cj.Namespace) rb.SetK8sCronjobUID(string(cj.UID)) rb.SetK8sCronjobName(cj.Name) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(metadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/demonset/daemonsets.go b/receiver/k8sclusterreceiver/internal/demonset/daemonsets.go index 303e9c9a24d9..da941cea39f9 100644 --- a/receiver/k8sclusterreceiver/internal/demonset/daemonsets.go +++ b/receiver/k8sclusterreceiver/internal/demonset/daemonsets.go @@ -36,7 +36,6 @@ func RecordMetrics(mb *metadata.MetricsBuilder, ds *appsv1.DaemonSet, ts pcommon rb.SetK8sNamespaceName(ds.Namespace) rb.SetK8sDaemonsetName(ds.Name) rb.SetK8sDaemonsetUID(string(ds.UID)) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(metadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/deployment/deployments.go b/receiver/k8sclusterreceiver/internal/deployment/deployments.go index 207b5c5caaa0..6f3eb2463ff6 100644 --- a/receiver/k8sclusterreceiver/internal/deployment/deployments.go +++ b/receiver/k8sclusterreceiver/internal/deployment/deployments.go @@ -35,7 +35,6 @@ func RecordMetrics(mb *imetadata.MetricsBuilder, dep *appsv1.Deployment, ts pcom rb.SetK8sDeploymentName(dep.Name) rb.SetK8sDeploymentUID(string(dep.UID)) rb.SetK8sNamespaceName(dep.Namespace) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(metadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/jobs/jobs.go b/receiver/k8sclusterreceiver/internal/jobs/jobs.go index fdd0e4e07ade..e54b5f22e3fc 100644 --- a/receiver/k8sclusterreceiver/internal/jobs/jobs.go +++ b/receiver/k8sclusterreceiver/internal/jobs/jobs.go @@ -28,7 +28,6 @@ func RecordMetrics(mb *metadata.MetricsBuilder, j *batchv1.Job, ts pcommon.Times rb.SetK8sNamespaceName(j.Namespace) rb.SetK8sJobName(j.Name) rb.SetK8sJobUID(string(j.UID)) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(metadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_config.go b/receiver/k8sclusterreceiver/internal/metadata/generated_config.go index 38c82e014053..91adaecbfd67 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_config.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_config.go @@ -255,7 +255,6 @@ type ResourceAttributesConfig struct { K8sResourcequotaUID ResourceAttributeConfig `mapstructure:"k8s.resourcequota.uid"` K8sStatefulsetName ResourceAttributeConfig `mapstructure:"k8s.statefulset.name"` K8sStatefulsetUID ResourceAttributeConfig `mapstructure:"k8s.statefulset.uid"` - OpencensusResourcetype ResourceAttributeConfig `mapstructure:"opencensus.resourcetype"` OpenshiftClusterquotaName ResourceAttributeConfig `mapstructure:"openshift.clusterquota.name"` OpenshiftClusterquotaUID ResourceAttributeConfig `mapstructure:"openshift.clusterquota.uid"` } @@ -352,9 +351,6 @@ func DefaultResourceAttributesConfig() ResourceAttributesConfig { K8sStatefulsetUID: ResourceAttributeConfig{ Enabled: true, }, - OpencensusResourcetype: ResourceAttributeConfig{ - Enabled: false, - }, OpenshiftClusterquotaName: ResourceAttributeConfig{ Enabled: true, }, diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go b/receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go index 97a1c8af9218..82e839640f5f 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go @@ -101,7 +101,6 @@ func TestMetricsBuilderConfig(t *testing.T) { K8sResourcequotaUID: ResourceAttributeConfig{Enabled: true}, K8sStatefulsetName: ResourceAttributeConfig{Enabled: true}, K8sStatefulsetUID: ResourceAttributeConfig{Enabled: true}, - OpencensusResourcetype: ResourceAttributeConfig{Enabled: true}, OpenshiftClusterquotaName: ResourceAttributeConfig{Enabled: true}, OpenshiftClusterquotaUID: ResourceAttributeConfig{Enabled: true}, }, @@ -186,7 +185,6 @@ func TestMetricsBuilderConfig(t *testing.T) { K8sResourcequotaUID: ResourceAttributeConfig{Enabled: false}, K8sStatefulsetName: ResourceAttributeConfig{Enabled: false}, K8sStatefulsetUID: ResourceAttributeConfig{Enabled: false}, - OpencensusResourcetype: ResourceAttributeConfig{Enabled: false}, OpenshiftClusterquotaName: ResourceAttributeConfig{Enabled: false}, OpenshiftClusterquotaUID: ResourceAttributeConfig{Enabled: false}, }, @@ -255,7 +253,6 @@ func TestResourceAttributesConfig(t *testing.T) { K8sResourcequotaUID: ResourceAttributeConfig{Enabled: true}, K8sStatefulsetName: ResourceAttributeConfig{Enabled: true}, K8sStatefulsetUID: ResourceAttributeConfig{Enabled: true}, - OpencensusResourcetype: ResourceAttributeConfig{Enabled: true}, OpenshiftClusterquotaName: ResourceAttributeConfig{Enabled: true}, OpenshiftClusterquotaUID: ResourceAttributeConfig{Enabled: true}, }, @@ -293,7 +290,6 @@ func TestResourceAttributesConfig(t *testing.T) { K8sResourcequotaUID: ResourceAttributeConfig{Enabled: false}, K8sStatefulsetName: ResourceAttributeConfig{Enabled: false}, K8sStatefulsetUID: ResourceAttributeConfig{Enabled: false}, - OpencensusResourcetype: ResourceAttributeConfig{Enabled: false}, OpenshiftClusterquotaName: ResourceAttributeConfig{Enabled: false}, OpenshiftClusterquotaUID: ResourceAttributeConfig{Enabled: false}, }, diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go index f3fa59fd1250..1f1eea8778fb 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go @@ -2197,9 +2197,6 @@ func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption { } func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder { - if mbc.ResourceAttributes.OpencensusResourcetype.enabledSetByUser { - settings.Logger.Warn("[WARNING] `opencensus.resourcetype` should not be configured: This resource_attribute is deprecated and will be removed soon.") - } mb := &MetricsBuilder{ config: mbc, startTime: pcommon.NewTimestampFromTime(time.Now()), diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go index be9f7b8fd361..2afd291beaa7 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go @@ -49,10 +49,6 @@ func TestMetricsBuilder(t *testing.T) { mb := NewMetricsBuilder(loadMetricsBuilderConfig(t, test.name), settings, WithStartTime(start)) expectedWarnings := 0 - if test.configSet == testSetAll || test.configSet == testSetNone { - assert.Equal(t, "[WARNING] `opencensus.resourcetype` should not be configured: This resource_attribute is deprecated and will be removed soon.", observedLogs.All()[expectedWarnings].Message) - expectedWarnings++ - } assert.Equal(t, expectedWarnings, observedLogs.Len()) @@ -261,7 +257,6 @@ func TestMetricsBuilder(t *testing.T) { rb.SetK8sResourcequotaUID("k8s.resourcequota.uid-val") rb.SetK8sStatefulsetName("k8s.statefulset.name-val") rb.SetK8sStatefulsetUID("k8s.statefulset.uid-val") - rb.SetOpencensusResourcetype("opencensus.resourcetype-val") rb.SetOpenshiftClusterquotaName("openshift.clusterquota.name-val") rb.SetOpenshiftClusterquotaUID("openshift.clusterquota.uid-val") res := rb.Emit() diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_resource.go b/receiver/k8sclusterreceiver/internal/metadata/generated_resource.go index 07a55e32d575..59b13e98c30c 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_resource.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_resource.go @@ -231,13 +231,6 @@ func (rb *ResourceBuilder) SetK8sStatefulsetUID(val string) { } } -// SetOpencensusResourcetype sets provided value as "opencensus.resourcetype" attribute. -func (rb *ResourceBuilder) SetOpencensusResourcetype(val string) { - if rb.config.OpencensusResourcetype.Enabled { - rb.res.Attributes().PutStr("opencensus.resourcetype", val) - } -} - // SetOpenshiftClusterquotaName sets provided value as "openshift.clusterquota.name" attribute. func (rb *ResourceBuilder) SetOpenshiftClusterquotaName(val string) { if rb.config.OpenshiftClusterquotaName.Enabled { diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go b/receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go index 6a2604011004..a26162228b51 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go @@ -43,7 +43,6 @@ func TestResourceBuilder(t *testing.T) { rb.SetK8sResourcequotaUID("k8s.resourcequota.uid-val") rb.SetK8sStatefulsetName("k8s.statefulset.name-val") rb.SetK8sStatefulsetUID("k8s.statefulset.uid-val") - rb.SetOpencensusResourcetype("opencensus.resourcetype-val") rb.SetOpenshiftClusterquotaName("openshift.clusterquota.name-val") rb.SetOpenshiftClusterquotaUID("openshift.clusterquota.uid-val") @@ -54,7 +53,7 @@ func TestResourceBuilder(t *testing.T) { case "default": assert.Equal(t, 30, res.Attributes().Len()) case "all_set": - assert.Equal(t, 33, res.Attributes().Len()) + assert.Equal(t, 32, res.Attributes().Len()) case "none_set": assert.Equal(t, 0, res.Attributes().Len()) return @@ -212,11 +211,6 @@ func TestResourceBuilder(t *testing.T) { if ok { assert.EqualValues(t, "k8s.statefulset.uid-val", val.Str()) } - val, ok = res.Attributes().Get("opencensus.resourcetype") - assert.Equal(t, test == "all_set", ok) - if ok { - assert.EqualValues(t, "opencensus.resourcetype-val", val.Str()) - } val, ok = res.Attributes().Get("openshift.clusterquota.name") assert.True(t, ok) if ok { diff --git a/receiver/k8sclusterreceiver/internal/metadata/testdata/config.yaml b/receiver/k8sclusterreceiver/internal/metadata/testdata/config.yaml index b04c4253e2c9..c78018044e86 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/testdata/config.yaml +++ b/receiver/k8sclusterreceiver/internal/metadata/testdata/config.yaml @@ -148,8 +148,6 @@ all_set: enabled: true k8s.statefulset.uid: enabled: true - opencensus.resourcetype: - enabled: true openshift.clusterquota.name: enabled: true openshift.clusterquota.uid: @@ -303,8 +301,6 @@ none_set: enabled: false k8s.statefulset.uid: enabled: false - opencensus.resourcetype: - enabled: false openshift.clusterquota.name: enabled: false openshift.clusterquota.uid: diff --git a/receiver/k8sclusterreceiver/internal/namespace/namespaces.go b/receiver/k8sclusterreceiver/internal/namespace/namespaces.go index 19fc86377049..2e317e79c65c 100644 --- a/receiver/k8sclusterreceiver/internal/namespace/namespaces.go +++ b/receiver/k8sclusterreceiver/internal/namespace/namespaces.go @@ -15,7 +15,6 @@ func RecordMetrics(mb *imetadata.MetricsBuilder, ns *corev1.Namespace, ts pcommo rb := mb.NewResourceBuilder() rb.SetK8sNamespaceUID(string(ns.UID)) rb.SetK8sNamespaceName(ns.Name) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(imetadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/node/nodes.go b/receiver/k8sclusterreceiver/internal/node/nodes.go index 8aeda3629eb0..9d939d1711be 100644 --- a/receiver/k8sclusterreceiver/internal/node/nodes.go +++ b/receiver/k8sclusterreceiver/internal/node/nodes.go @@ -95,7 +95,6 @@ func CustomMetrics(set receiver.CreateSettings, rb *metadata.ResourceBuilder, no rb.SetK8sNodeUID(string(node.UID)) rb.SetK8sNodeName(node.Name) - rb.SetOpencensusResourcetype("k8s") rb.SetK8sKubeletVersion(node.Status.NodeInfo.KubeletVersion) rb.SetK8sKubeproxyVersion(node.Status.NodeInfo.KubeProxyVersion) rb.Emit().MoveTo(rm.Resource()) diff --git a/receiver/k8sclusterreceiver/internal/pod/pods.go b/receiver/k8sclusterreceiver/internal/pod/pods.go index 67f05951bae8..ffcff3e2c6ea 100644 --- a/receiver/k8sclusterreceiver/internal/pod/pods.go +++ b/receiver/k8sclusterreceiver/internal/pod/pods.go @@ -76,7 +76,6 @@ func RecordMetrics(logger *zap.Logger, mb *metadata.MetricsBuilder, pod *corev1. rb.SetK8sNodeName(pod.Spec.NodeName) rb.SetK8sPodName(pod.Name) rb.SetK8sPodUID(string(pod.UID)) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(metadata.WithResource(rb.Emit())) for _, c := range pod.Spec.Containers { diff --git a/receiver/k8sclusterreceiver/internal/replicaset/replicasets.go b/receiver/k8sclusterreceiver/internal/replicaset/replicasets.go index d3fde6ca6f3c..8d9672dc0e60 100644 --- a/receiver/k8sclusterreceiver/internal/replicaset/replicasets.go +++ b/receiver/k8sclusterreceiver/internal/replicaset/replicasets.go @@ -36,7 +36,6 @@ func RecordMetrics(mb *metadata.MetricsBuilder, rs *appsv1.ReplicaSet, ts pcommo rb.SetK8sNamespaceName(rs.Namespace) rb.SetK8sReplicasetName(rs.Name) rb.SetK8sReplicasetUID(string(rs.UID)) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(metadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/replicationcontroller/replicationcontrollers.go b/receiver/k8sclusterreceiver/internal/replicationcontroller/replicationcontrollers.go index f4fb422c5356..0cd02810848e 100644 --- a/receiver/k8sclusterreceiver/internal/replicationcontroller/replicationcontrollers.go +++ b/receiver/k8sclusterreceiver/internal/replicationcontroller/replicationcontrollers.go @@ -22,7 +22,6 @@ func RecordMetrics(mb *metadata.MetricsBuilder, rc *corev1.ReplicationController rb.SetK8sNamespaceName(rc.Namespace) rb.SetK8sReplicationcontrollerName(rc.Name) rb.SetK8sReplicationcontrollerUID(string(rc.UID)) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(metadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/resourcequota/resourcequotas.go b/receiver/k8sclusterreceiver/internal/resourcequota/resourcequotas.go index 6d286a95c2c4..d20d2134befc 100644 --- a/receiver/k8sclusterreceiver/internal/resourcequota/resourcequotas.go +++ b/receiver/k8sclusterreceiver/internal/resourcequota/resourcequotas.go @@ -33,6 +33,5 @@ func RecordMetrics(mb *metadata.MetricsBuilder, rq *corev1.ResourceQuota, ts pco rb.SetK8sResourcequotaUID(string(rq.UID)) rb.SetK8sResourcequotaName(rq.Name) rb.SetK8sNamespaceName(rq.Namespace) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(metadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/internal/statefulset/statefulsets.go b/receiver/k8sclusterreceiver/internal/statefulset/statefulsets.go index e1d4b29e1ce3..36968edb1c29 100644 --- a/receiver/k8sclusterreceiver/internal/statefulset/statefulsets.go +++ b/receiver/k8sclusterreceiver/internal/statefulset/statefulsets.go @@ -47,7 +47,6 @@ func RecordMetrics(mb *imetadata.MetricsBuilder, ss *appsv1.StatefulSet, ts pcom rb.SetK8sStatefulsetUID(string(ss.UID)) rb.SetK8sStatefulsetName(ss.Name) rb.SetK8sNamespaceName(ss.Namespace) - rb.SetOpencensusResourcetype("k8s") mb.EmitForResource(imetadata.WithResource(rb.Emit())) } diff --git a/receiver/k8sclusterreceiver/metadata.yaml b/receiver/k8sclusterreceiver/metadata.yaml index edb10e1a2f67..fceeccb83c3e 100644 --- a/receiver/k8sclusterreceiver/metadata.yaml +++ b/receiver/k8sclusterreceiver/metadata.yaml @@ -172,13 +172,6 @@ resource_attributes: type: string enabled: true - opencensus.resourcetype: - description: The OpenCensus resource type. - type: string - enabled: false - warnings: - if_configured: This resource_attribute is deprecated and will be removed soon. - attributes: k8s.namespace.name: description: The k8s namespace name.