From 15f986da17104b7299e579ea403e72ccfe864457 Mon Sep 17 00:00:00 2001 From: Chad Patel Date: Mon, 18 Sep 2023 16:10:49 -0500 Subject: [PATCH] Pod age revert (#94) * Revert "Pod age (#87)" This reverts commit dc5e1490a6812500943858ecb5bb13f33c935a01. * add back some unwanted revert stuff to the readme --- internal/aws/containerinsight/const.go | 18 ++++++++---------- receiver/awscontainerinsightreceiver/README.md | 2 -- .../internal/stores/podstore.go | 2 -- .../internal/stores/podstore_test.go | 9 --------- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/internal/aws/containerinsight/const.go b/internal/aws/containerinsight/const.go index d90106aa20bf..704e53a56865 100644 --- a/internal/aws/containerinsight/const.go +++ b/internal/aws/containerinsight/const.go @@ -117,14 +117,14 @@ const ( ReplicasDesired = "replicas_desired" ReplicasReady = "replicas_ready" - RunningPodCount = "number_of_running_pods" - RunningContainerCount = "number_of_running_containers" - ContainerCount = "number_of_containers" - NodeCount = "node_count" - FailedNodeCount = "failed_node_count" - ContainerRestartCount = "number_of_container_restarts" - RunningTaskCount = "number_of_running_tasks" - Age = "age" + RunningPodCount = "number_of_running_pods" + RunningContainerCount = "number_of_running_containers" + ContainerCount = "number_of_containers" + NodeCount = "node_count" + FailedNodeCount = "failed_node_count" + ContainerRestartCount = "number_of_container_restarts" + RunningTaskCount = "number_of_running_tasks" + DiskIOServiceBytesPrefix = "diskio_io_service_bytes_" DiskIOServicedPrefix = "diskio_io_serviced_" DiskIOAsync = "Async" @@ -162,7 +162,6 @@ const ( // unit UnitBytes = "Bytes" UnitMegaBytes = "Megabytes" - UnitSeconds = "Seconds" UnitNanoSecond = "Nanoseconds" UnitBytesPerSec = "Bytes/Second" UnitCount = "Count" @@ -281,6 +280,5 @@ func init() { ContainerCount: UnitCount, ContainerRestartCount: UnitCount, RunningTaskCount: UnitCount, - Age: UnitSeconds, } } diff --git a/receiver/awscontainerinsightreceiver/README.md b/receiver/awscontainerinsightreceiver/README.md index 3ec9a1280654..e8d31aa1c1f5 100644 --- a/receiver/awscontainerinsightreceiver/README.md +++ b/receiver/awscontainerinsightreceiver/README.md @@ -714,8 +714,6 @@ kubectl apply -f config.yaml | pod_status_pending | Count | | pod_status_running | Count | | pod_status_succeeded | Count | -| pod_age | Seconds | - | Resource Attribute | |----------------------| diff --git a/receiver/awscontainerinsightreceiver/internal/stores/podstore.go b/receiver/awscontainerinsightreceiver/internal/stores/podstore.go index 555855f2b02d..aff52addf8c1 100644 --- a/receiver/awscontainerinsightreceiver/internal/stores/podstore.go +++ b/receiver/awscontainerinsightreceiver/internal/stores/podstore.go @@ -478,8 +478,6 @@ func (p *PodStore) addStatus(metric CIMetric, pod *corev1.Pod) { if p.includeEnhancedMetrics { p.addPodStatusMetrics(metric, pod) p.addPodConditionMetrics(metric, pod) - podAge := time.Since(pod.CreationTimestamp.Time) - metric.AddField(ci.MetricName(ci.TypePod, ci.Age), podAge.Seconds()) } var curContainerRestarts int diff --git a/receiver/awscontainerinsightreceiver/internal/stores/podstore_test.go b/receiver/awscontainerinsightreceiver/internal/stores/podstore_test.go index 6257f5cd438a..2c7ea3dd6580 100644 --- a/receiver/awscontainerinsightreceiver/internal/stores/podstore_test.go +++ b/receiver/awscontainerinsightreceiver/internal/stores/podstore_test.go @@ -346,7 +346,6 @@ const ( PodUnknownMetricName = "pod_status_unknown" PodReadyMetricName = "pod_status_ready" PodScheduledMetricName = "pod_status_scheduled" - PodAgeMetricName = "pod_age" ) func TestPodStore_enhanced_metrics_disabled(t *testing.T) { @@ -394,14 +393,6 @@ func TestPodStore_addStatus_adds_pod_succeeded_metric(t *testing.T) { assert.Equal(t, 1, decoratedResultMetric.GetField(PodSucceededMetricName)) } -func TestPodStore_addStatus_pod_age(t *testing.T) { - decoratedResultMetric := runAddStatusToGetDecoratedCIMetric("./test_resources/pod_in_phase_succeeded.json", true) - year := time.Hour * 24 * 365 - - assert.Greater(t, decoratedResultMetric.GetField(PodAgeMetricName), 3*year.Seconds()) - assert.Less(t, decoratedResultMetric.GetField(PodAgeMetricName), 100*year.Seconds()) -} - func TestPodStore_addStatus_enhanced_metrics_disabled(t *testing.T) { decoratedResultMetric := runAddStatusToGetDecoratedCIMetric("./test_resources/all_pod_conditions_valid.json", false)