diff --git a/.chloggen/k8sclusterreceiver-change-units.yaml b/.chloggen/k8sclusterreceiver-change-units.yaml new file mode 100755 index 000000000000..496e23bff81b --- /dev/null +++ b/.chloggen/k8sclusterreceiver-change-units.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: bug_fix + +# 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: "Change clusterquota and resourcequota metrics to use {resource} unit" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [10553] + +# (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: [] diff --git a/receiver/k8sclusterreceiver/documentation.md b/receiver/k8sclusterreceiver/documentation.md index 326521bf889c..e2fffca2edae 100644 --- a/receiver/k8sclusterreceiver/documentation.md +++ b/receiver/k8sclusterreceiver/documentation.md @@ -274,7 +274,7 @@ The upper limit for a particular resource in a specific namespace. Will only be | Unit | Metric Type | Value Type | | ---- | ----------- | ---------- | -| 1 | Gauge | Int | +| {resource} | Gauge | Int | #### Attributes @@ -288,7 +288,7 @@ The usage for a particular resource in a specific namespace. Will only be sent i | Unit | Metric Type | Value Type | | ---- | ----------- | ---------- | -| 1 | Gauge | Int | +| {resource} | Gauge | Int | #### Attributes @@ -334,7 +334,7 @@ The upper limit for a particular resource in a specific namespace. | Unit | Metric Type | Value Type | | ---- | ----------- | ---------- | -| 1 | Gauge | Int | +| {resource} | Gauge | Int | #### Attributes @@ -349,7 +349,7 @@ The usage for a particular resource in a specific namespace. | Unit | Metric Type | Value Type | | ---- | ----------- | ---------- | -| 1 | Gauge | Int | +| {resource} | Gauge | Int | #### Attributes @@ -364,7 +364,7 @@ The configured upper limit for a particular resource. | Unit | Metric Type | Value Type | | ---- | ----------- | ---------- | -| 1 | Gauge | Int | +| {resource} | Gauge | Int | #### Attributes @@ -378,7 +378,7 @@ The usage for a particular resource with a configured limit. | Unit | Metric Type | Value Type | | ---- | ----------- | ---------- | -| 1 | Gauge | Int | +| {resource} | Gauge | Int | #### Attributes diff --git a/receiver/k8sclusterreceiver/internal/clusterresourcequota/testdata/expected.yaml b/receiver/k8sclusterreceiver/internal/clusterresourcequota/testdata/expected.yaml index 40aa47897779..4f599ba9e7c9 100644 --- a/receiver/k8sclusterreceiver/internal/clusterresourcequota/testdata/expected.yaml +++ b/receiver/k8sclusterreceiver/internal/clusterresourcequota/testdata/expected.yaml @@ -19,7 +19,7 @@ resourceMetrics: value: stringValue: requests.cpu name: openshift.clusterquota.limit - unit: "1" + unit: "{resource}" - description: The usage for a particular resource with a configured limit. gauge: dataPoints: @@ -29,7 +29,7 @@ resourceMetrics: value: stringValue: requests.cpu name: openshift.clusterquota.used - unit: "1" + unit: "{resource}" - description: The upper limit for a particular resource in a specific namespace. gauge: dataPoints: @@ -50,7 +50,7 @@ resourceMetrics: value: stringValue: "ns2" name: openshift.appliedclusterquota.limit - unit: "1" + unit: "{resource}" - description: The usage for a particular resource in a specific namespace. gauge: dataPoints: @@ -72,7 +72,7 @@ resourceMetrics: value: stringValue: "ns2" name: openshift.appliedclusterquota.used - unit: "1" + unit: "{resource}" scope: name: otelcol/k8sclusterreceiver version: latest diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go index 1f1eea8778fb..65f97a8fec2f 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go @@ -1639,7 +1639,7 @@ type metricK8sResourceQuotaHardLimit struct { func (m *metricK8sResourceQuotaHardLimit) init() { m.data.SetName("k8s.resource_quota.hard_limit") m.data.SetDescription("The upper limit for a particular resource in a specific namespace. Will only be sent if a quota is specified. CPU requests/limits will be sent as millicores") - m.data.SetUnit("1") + m.data.SetUnit("{resource}") m.data.SetEmptyGauge() m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) } @@ -1690,7 +1690,7 @@ type metricK8sResourceQuotaUsed struct { func (m *metricK8sResourceQuotaUsed) init() { m.data.SetName("k8s.resource_quota.used") m.data.SetDescription("The usage for a particular resource in a specific namespace. Will only be sent if a quota is specified. CPU requests/limits will be sent as millicores") - m.data.SetUnit("1") + m.data.SetUnit("{resource}") m.data.SetEmptyGauge() m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) } @@ -1937,7 +1937,7 @@ type metricOpenshiftAppliedclusterquotaLimit struct { func (m *metricOpenshiftAppliedclusterquotaLimit) init() { m.data.SetName("openshift.appliedclusterquota.limit") m.data.SetDescription("The upper limit for a particular resource in a specific namespace.") - m.data.SetUnit("1") + m.data.SetUnit("{resource}") m.data.SetEmptyGauge() m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) } @@ -1989,7 +1989,7 @@ type metricOpenshiftAppliedclusterquotaUsed struct { func (m *metricOpenshiftAppliedclusterquotaUsed) init() { m.data.SetName("openshift.appliedclusterquota.used") m.data.SetDescription("The usage for a particular resource in a specific namespace.") - m.data.SetUnit("1") + m.data.SetUnit("{resource}") m.data.SetEmptyGauge() m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) } @@ -2041,7 +2041,7 @@ type metricOpenshiftClusterquotaLimit struct { func (m *metricOpenshiftClusterquotaLimit) init() { m.data.SetName("openshift.clusterquota.limit") m.data.SetDescription("The configured upper limit for a particular resource.") - m.data.SetUnit("1") + m.data.SetUnit("{resource}") m.data.SetEmptyGauge() m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) } @@ -2092,7 +2092,7 @@ type metricOpenshiftClusterquotaUsed struct { func (m *metricOpenshiftClusterquotaUsed) init() { m.data.SetName("openshift.clusterquota.used") m.data.SetDescription("The usage for a particular resource with a configured limit.") - m.data.SetUnit("1") + m.data.SetUnit("{resource}") m.data.SetEmptyGauge() m.data.Gauge().DataPoints().EnsureCapacity(m.capacity) } diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go index 4df3641aa383..2123b700d69f 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go @@ -684,7 +684,7 @@ func TestMetricsBuilder(t *testing.T) { assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) assert.Equal(t, "The upper limit for a particular resource in a specific namespace. Will only be sent if a quota is specified. CPU requests/limits will be sent as millicores", ms.At(i).Description()) - assert.Equal(t, "1", ms.At(i).Unit()) + assert.Equal(t, "{resource}", ms.At(i).Unit()) dp := ms.At(i).Gauge().DataPoints().At(0) assert.Equal(t, start, dp.StartTimestamp()) assert.Equal(t, ts, dp.Timestamp()) @@ -699,7 +699,7 @@ func TestMetricsBuilder(t *testing.T) { assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) assert.Equal(t, "The usage for a particular resource in a specific namespace. Will only be sent if a quota is specified. CPU requests/limits will be sent as millicores", ms.At(i).Description()) - assert.Equal(t, "1", ms.At(i).Unit()) + assert.Equal(t, "{resource}", ms.At(i).Unit()) dp := ms.At(i).Gauge().DataPoints().At(0) assert.Equal(t, start, dp.StartTimestamp()) assert.Equal(t, ts, dp.Timestamp()) @@ -762,7 +762,7 @@ func TestMetricsBuilder(t *testing.T) { assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) assert.Equal(t, "The upper limit for a particular resource in a specific namespace.", ms.At(i).Description()) - assert.Equal(t, "1", ms.At(i).Unit()) + assert.Equal(t, "{resource}", ms.At(i).Unit()) dp := ms.At(i).Gauge().DataPoints().At(0) assert.Equal(t, start, dp.StartTimestamp()) assert.Equal(t, ts, dp.Timestamp()) @@ -780,7 +780,7 @@ func TestMetricsBuilder(t *testing.T) { assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) assert.Equal(t, "The usage for a particular resource in a specific namespace.", ms.At(i).Description()) - assert.Equal(t, "1", ms.At(i).Unit()) + assert.Equal(t, "{resource}", ms.At(i).Unit()) dp := ms.At(i).Gauge().DataPoints().At(0) assert.Equal(t, start, dp.StartTimestamp()) assert.Equal(t, ts, dp.Timestamp()) @@ -798,7 +798,7 @@ func TestMetricsBuilder(t *testing.T) { assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) assert.Equal(t, "The configured upper limit for a particular resource.", ms.At(i).Description()) - assert.Equal(t, "1", ms.At(i).Unit()) + assert.Equal(t, "{resource}", ms.At(i).Unit()) dp := ms.At(i).Gauge().DataPoints().At(0) assert.Equal(t, start, dp.StartTimestamp()) assert.Equal(t, ts, dp.Timestamp()) @@ -813,7 +813,7 @@ func TestMetricsBuilder(t *testing.T) { assert.Equal(t, pmetric.MetricTypeGauge, ms.At(i).Type()) assert.Equal(t, 1, ms.At(i).Gauge().DataPoints().Len()) assert.Equal(t, "The usage for a particular resource with a configured limit.", ms.At(i).Description()) - assert.Equal(t, "1", ms.At(i).Unit()) + assert.Equal(t, "{resource}", ms.At(i).Unit()) dp := ms.At(i).Gauge().DataPoints().At(0) assert.Equal(t, start, dp.StartTimestamp()) assert.Equal(t, ts, dp.Timestamp()) diff --git a/receiver/k8sclusterreceiver/internal/resourcequota/testdata/expected.yaml b/receiver/k8sclusterreceiver/internal/resourcequota/testdata/expected.yaml index 2adfc5b2181f..1e6384bf5f3f 100644 --- a/receiver/k8sclusterreceiver/internal/resourcequota/testdata/expected.yaml +++ b/receiver/k8sclusterreceiver/internal/resourcequota/testdata/expected.yaml @@ -22,7 +22,7 @@ resourceMetrics: value: stringValue: requests.cpu name: k8s.resource_quota.hard_limit - unit: "1" + unit: "{resource}" - description: The usage for a particular resource in a specific namespace. Will only be sent if a quota is specified. CPU requests/limits will be sent as millicores gauge: dataPoints: @@ -32,7 +32,7 @@ resourceMetrics: value: stringValue: requests.cpu name: k8s.resource_quota.used - unit: "1" + unit: "{resource}" scope: name: otelcol/k8sclusterreceiver version: latest diff --git a/receiver/k8sclusterreceiver/metadata.yaml b/receiver/k8sclusterreceiver/metadata.yaml index 0c8e8ebebaaa..40fde1e957e6 100644 --- a/receiver/k8sclusterreceiver/metadata.yaml +++ b/receiver/k8sclusterreceiver/metadata.yaml @@ -402,7 +402,7 @@ metrics: k8s.resource_quota.hard_limit: enabled: true description: The upper limit for a particular resource in a specific namespace. Will only be sent if a quota is specified. CPU requests/limits will be sent as millicores - unit: 1 + unit: "{resource}" gauge: value_type: int attributes: @@ -410,7 +410,7 @@ metrics: k8s.resource_quota.used: enabled: true description: The usage for a particular resource in a specific namespace. Will only be sent if a quota is specified. CPU requests/limits will be sent as millicores - unit: 1 + unit: "{resource}" gauge: value_type: int attributes: @@ -447,7 +447,7 @@ metrics: openshift.clusterquota.limit: enabled: true description: The configured upper limit for a particular resource. - unit: "1" + unit: "{resource}" gauge: value_type: int attributes: @@ -455,7 +455,7 @@ metrics: openshift.clusterquota.used: enabled: true description: The usage for a particular resource with a configured limit. - unit: "1" + unit: "{resource}" gauge: value_type: int attributes: @@ -463,7 +463,7 @@ metrics: openshift.appliedclusterquota.limit: enabled: true description: The upper limit for a particular resource in a specific namespace. - unit: "1" + unit: "{resource}" gauge: value_type: int attributes: @@ -472,7 +472,7 @@ metrics: openshift.appliedclusterquota.used: enabled: true description: The usage for a particular resource in a specific namespace. - unit: "1" + unit: "{resource}" gauge: value_type: int attributes: