Skip to content

Commit

Permalink
Pod age revert (amazon-contributing#94)
Browse files Browse the repository at this point in the history
* Revert "Pod age (amazon-contributing#87)"

This reverts commit dc5e149.

* add back some unwanted revert stuff to the readme
  • Loading branch information
chadpatel authored and lisguo committed Oct 20, 2023
1 parent ad85749 commit 15f986d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
18 changes: 8 additions & 10 deletions internal/aws/containerinsight/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -162,7 +162,6 @@ const (
// unit
UnitBytes = "Bytes"
UnitMegaBytes = "Megabytes"
UnitSeconds = "Seconds"
UnitNanoSecond = "Nanoseconds"
UnitBytesPerSec = "Bytes/Second"
UnitCount = "Count"
Expand Down Expand Up @@ -281,6 +280,5 @@ func init() {
ContainerCount: UnitCount,
ContainerRestartCount: UnitCount,
RunningTaskCount: UnitCount,
Age: UnitSeconds,
}
}
2 changes: 0 additions & 2 deletions receiver/awscontainerinsightreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
|----------------------|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 15f986d

Please sign in to comment.