Skip to content

Commit

Permalink
move container_status_ metrics to pod_container_ so we can pick up sh… (
Browse files Browse the repository at this point in the history
#109)

* move container_status_ metrics to pod_container_ so we can pick up short lived container states

* update README

* update README

* minor refactor so units work
  • Loading branch information
chadpatel authored Oct 10, 2023
1 parent fe0f140 commit ca00a4d
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 168 deletions.
107 changes: 54 additions & 53 deletions internal/aws/containerinsight/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,38 +76,39 @@ const (
FSInodesfree = "filesystem_inodes_free"
FSUtilization = "filesystem_utilization"

StatusConditionReady = "status_condition_ready"
StatusConditionDiskPressure = "status_condition_disk_pressure"
StatusConditionMemoryPressure = "status_condition_memory_pressure"
StatusConditionPIDPressure = "status_condition_pid_pressure"
StatusConditionNetworkUnavailable = "status_condition_network_unavailable"
StatusConditionUnknown = "status_condition_unknown"
StatusCapacityPods = "status_capacity_pods"
StatusAllocatablePods = "status_allocatable_pods"
StatusNumberAvailable = "status_number_available"
StatusNumberUnavailable = "status_number_unavailable"
StatusDesiredNumberScheduled = "status_desired_number_scheduled"
StatusCurrentNumberScheduled = "status_current_number_scheduled"
StatusReplicasAvailable = "status_replicas_available"
StatusReplicasUnavailable = "status_replicas_unavailable"
SpecReplicas = "spec_replicas"
StatusRunning = "status_running"
StatusTerminated = "status_terminated"
StatusWaiting = "status_waiting"
StatusWaitingReasonCrashLoopBackOff = "status_waiting_reason_crash_loop_back_off"
StatusWaitingReasonImagePullError = "status_waiting_reason_image_pull_error"
StatusWaitingReasonStartError = "status_waiting_reason_start_error"
StatusWaitingReasonCreateContainerError = "status_waiting_reason_create_container_error"
StatusWaitingReasonCreateContainerConfigError = "status_waiting_reason_create_container_config_error"
StatusTerminatedReasonOOMKilled = "status_terminated_reason_oom_killed"
StatusPending = "status_pending"
StatusSucceeded = "status_succeeded"
StatusFailed = "status_failed"
StatusUnknown = "status_unknown"
StatusReady = "status_ready"
StatusScheduled = "status_scheduled"
ReplicasDesired = "replicas_desired"
ReplicasReady = "replicas_ready"
StatusConditionReady = "status_condition_ready"
StatusConditionDiskPressure = "status_condition_disk_pressure"
StatusConditionMemoryPressure = "status_condition_memory_pressure"
StatusConditionPIDPressure = "status_condition_pid_pressure"
StatusConditionNetworkUnavailable = "status_condition_network_unavailable"
StatusConditionUnknown = "status_condition_unknown"
StatusCapacityPods = "status_capacity_pods"
StatusAllocatablePods = "status_allocatable_pods"
StatusNumberAvailable = "status_number_available"
StatusNumberUnavailable = "status_number_unavailable"
StatusDesiredNumberScheduled = "status_desired_number_scheduled"
StatusCurrentNumberScheduled = "status_current_number_scheduled"
StatusReplicasAvailable = "status_replicas_available"
StatusReplicasUnavailable = "status_replicas_unavailable"
SpecReplicas = "spec_replicas"
StatusContainerRunning = "container_status_running"
StatusContainerTerminated = "container_status_terminated"
StatusContainerWaiting = "container_status_waiting"
StatusContainerWaitingReasonCrashLoopBackOff = "container_status_waiting_reason_crash_loop_back_off"
StatusContainerWaitingReasonImagePullError = "container_status_waiting_reason_image_pull_error"
StatusContainerWaitingReasonStartError = "container_status_waiting_reason_start_error"
StatusContainerWaitingReasonCreateContainerError = "container_status_waiting_reason_create_container_error"
StatusContainerWaitingReasonCreateContainerConfigError = "container_status_waiting_reason_create_container_config_error"
StatusContainerTerminatedReasonOOMKilled = "container_status_terminated_reason_oom_killed"
StatusRunning = "status_running"
StatusPending = "status_pending"
StatusSucceeded = "status_succeeded"
StatusFailed = "status_failed"
StatusUnknown = "status_unknown"
StatusReady = "status_ready"
StatusScheduled = "status_scheduled"
ReplicasDesired = "replicas_desired"
ReplicasReady = "replicas_ready"

RunningPodCount = "number_of_running_pods"
RunningContainerCount = "number_of_running_containers"
Expand Down Expand Up @@ -163,13 +164,13 @@ const (
)

var WaitingReasonLookup = map[string]string{
"CrashLoopBackOff": StatusWaitingReasonCrashLoopBackOff,
"ErrImagePull": StatusWaitingReasonImagePullError,
"ImagePullBackOff": StatusWaitingReasonImagePullError,
"InvalidImageName": StatusWaitingReasonImagePullError,
"CreateContainerError": StatusWaitingReasonCreateContainerError,
"CreateContainerConfigError": StatusWaitingReasonCreateContainerConfigError,
"StartError": StatusWaitingReasonStartError,
"CrashLoopBackOff": StatusContainerWaitingReasonCrashLoopBackOff,
"ErrImagePull": StatusContainerWaitingReasonImagePullError,
"ImagePullBackOff": StatusContainerWaitingReasonImagePullError,
"InvalidImageName": StatusContainerWaitingReasonImagePullError,
"CreateContainerError": StatusContainerWaitingReasonCreateContainerError,
"CreateContainerConfigError": StatusContainerWaitingReasonCreateContainerConfigError,
"StartError": StatusContainerWaitingReasonStartError,
}

var metricToUnitMap map[string]string
Expand Down Expand Up @@ -261,20 +262,20 @@ func init() {
ReplicasReady: UnitCount,

// kube-state-metrics equivalents
StatusRunning: UnitCount,
StatusTerminated: UnitCount,
StatusWaiting: UnitCount,
StatusWaitingReasonCrashLoopBackOff: UnitCount,
StatusWaitingReasonImagePullError: UnitCount,
StatusWaitingReasonStartError: UnitCount,
StatusWaitingReasonCreateContainerConfigError: UnitCount,
StatusWaitingReasonCreateContainerError: UnitCount,
StatusFailed: UnitCount,
StatusPending: UnitCount,
StatusSucceeded: UnitCount,
StatusUnknown: UnitCount,
StatusReady: UnitCount,
StatusScheduled: UnitCount,
StatusContainerRunning: UnitCount,
StatusContainerTerminated: UnitCount,
StatusContainerWaiting: UnitCount,
StatusContainerWaitingReasonCrashLoopBackOff: UnitCount,
StatusContainerWaitingReasonImagePullError: UnitCount,
StatusContainerWaitingReasonStartError: UnitCount,
StatusContainerWaitingReasonCreateContainerConfigError: UnitCount,
StatusContainerWaitingReasonCreateContainerError: UnitCount,
StatusFailed: UnitCount,
StatusPending: UnitCount,
StatusSucceeded: UnitCount,
StatusUnknown: UnitCount,
StatusReady: UnitCount,
StatusScheduled: UnitCount,

// cluster metrics
NodeCount: UnitCount,
Expand Down
110 changes: 55 additions & 55 deletions receiver/awscontainerinsightreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -687,52 +687,61 @@ kubectl apply -f config.yaml
<br/><br/>

### Pod
| Metric | Unit |
|---------------------------------------|--------------|
| pod_cpu_limit | Millicore |
| pod_cpu_request | Millicore |
| pod_cpu_reserved_capacity | Percent |
| pod_cpu_usage_system | Millicore |
| pod_cpu_usage_total | Millicore |
| pod_cpu_usage_user | Millicore |
| pod_cpu_utilization | Percent |
| pod_cpu_utilization_over_pod_limit | Percent |
| pod_memory_cache | Bytes |
| pod_memory_failcnt | Count |
| pod_memory_hierarchical_pgfault | Count/Second |
| pod_memory_hierarchical_pgmajfault | Count/Second |
| pod_memory_limit | Bytes |
| pod_memory_mapped_file | Bytes |
| pod_memory_max_usage | Bytes |
| pod_memory_pgfault | Count/Second |
| pod_memory_pgmajfault | Count/Second |
| pod_memory_request | Bytes |
| pod_memory_reserved_capacity | Percent |
| pod_memory_rss | Bytes |
| pod_memory_swap | Bytes |
| pod_memory_usage | Bytes |
| pod_memory_utilization | Percent |
| pod_memory_utilization_over_pod_limit | Percent |
| pod_memory_working_set | Bytes |
| pod_network_rx_bytes | Bytes/Second |
| pod_network_rx_dropped | Count/Second |
| pod_network_rx_errors | Count/Second |
| pod_network_rx_packets | Count/Second |
| pod_network_total_bytes | Bytes/Second |
| pod_network_tx_bytes | Bytes/Second |
| pod_network_tx_dropped | Count/Second |
| pod_network_tx_errors | Count/Second |
| pod_network_tx_packets | Count/Second |
| pod_number_of_container_restarts | Count |
| pod_number_of_containers | Count |
| pod_number_of_running_containers | Count |
| pod_status_ready | Count |
| pod_status_scheduled | Count |
| pod_status_unknown | Count |
| pod_status_failed | Count |
| pod_status_pending | Count |
| pod_status_running | Count |
| pod_status_succeeded | Count |
| Metric | Unit |
|-------------------------------------------------------------------|--------------|
| pod_cpu_limit | Millicore |
| pod_cpu_request | Millicore |
| pod_cpu_reserved_capacity | Percent |
| pod_cpu_usage_system | Millicore |
| pod_cpu_usage_total | Millicore |
| pod_cpu_usage_user | Millicore |
| pod_cpu_utilization | Percent |
| pod_cpu_utilization_over_pod_limit | Percent |
| pod_memory_cache | Bytes |
| pod_memory_failcnt | Count |
| pod_memory_hierarchical_pgfault | Count/Second |
| pod_memory_hierarchical_pgmajfault | Count/Second |
| pod_memory_limit | Bytes |
| pod_memory_mapped_file | Bytes |
| pod_memory_max_usage | Bytes |
| pod_memory_pgfault | Count/Second |
| pod_memory_pgmajfault | Count/Second |
| pod_memory_request | Bytes |
| pod_memory_reserved_capacity | Percent |
| pod_memory_rss | Bytes |
| pod_memory_swap | Bytes |
| pod_memory_usage | Bytes |
| pod_memory_utilization | Percent |
| pod_memory_utilization_over_pod_limit | Percent |
| pod_memory_working_set | Bytes |
| pod_network_rx_bytes | Bytes/Second |
| pod_network_rx_dropped | Count/Second |
| pod_network_rx_errors | Count/Second |
| pod_network_rx_packets | Count/Second |
| pod_network_total_bytes | Bytes/Second |
| pod_network_tx_bytes | Bytes/Second |
| pod_network_tx_dropped | Count/Second |
| pod_network_tx_errors | Count/Second |
| pod_network_tx_packets | Count/Second |
| pod_number_of_container_restarts | Count |
| pod_number_of_containers | Count |
| pod_number_of_running_containers | Count |
| pod_status_ready | Count |
| pod_status_scheduled | Count |
| pod_status_unknown | Count |
| pod_status_failed | Count |
| pod_status_pending | Count |
| pod_status_running | Count |
| pod_status_succeeded | Count |
| pod_container_status_running | Count |
| pod_container_status_terminated | Count |
| pod_container_status_waiting | Count |
| pod_container_status_waiting_reason_crash_loop_back_off | Count |
| pod_container_status_waiting_reason_image_pull_error | Count |
| pod_container_status_waiting_reason_start_error | Count |
| pod_container_status_waiting_reason_create_container_error | Count |
| pod_container_status_waiting_reason_create_container_config_error | Count |
| pod_container_status_terminated_reason_oom_killed | Count |

| Resource Attribute |
|----------------------|
Expand Down Expand Up @@ -816,15 +825,6 @@ kubectl apply -f config.yaml
| container_memory_utilization_over_container_limit | Percent |
| container_memory_working_set | Bytes |
| number_of_container_restarts | Count |
| container_status_running | Count |
| container_status_terminated | Count |
| container_status_waiting | Count |
| container_status_waiting_reason_crash_loop_back_off | Count |
| container_status_waiting_reason_image_pull_error | Count |
| container_status_waiting_reason_start_error | Count |
| container_status_waiting_reason_create_container_error | Count |
| container_status_waiting_reason_create_container_config_error | Count |
| container_status_terminated_reason_oom_killed | Count |

<br/><br/>

Expand Down
Loading

0 comments on commit ca00a4d

Please sign in to comment.