Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions receiver/awscontainerinsightreceiver/internal/stores/nodeinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func (n *nodeInfo) getNodeStats() nodeStats {
}

func (n *nodeInfo) getNodeStatusCapacityPods() (uint64, bool) {
if n.provider == nil {
return 0, false
}
capacityResources, ok := n.provider.NodeToCapacityMap()[n.nodeName]
if !ok {
return 0, false
Expand All @@ -105,6 +108,9 @@ func (n *nodeInfo) getNodeStatusCapacityPods() (uint64, bool) {
}

func (n *nodeInfo) getNodeStatusAllocatablePods() (uint64, bool) {
if n.provider == nil {
return 0, false
}
allocatableResources, ok := n.provider.NodeToAllocatableMap()[n.nodeName]
if !ok {
return 0, false
Expand All @@ -114,6 +120,9 @@ func (n *nodeInfo) getNodeStatusAllocatablePods() (uint64, bool) {
}

func (n *nodeInfo) getNodeStatusCapacityGPUs() (uint64, bool) {
if n.provider == nil {
return 0, false
}
capacityResources, ok := n.provider.NodeToCapacityMap()[n.nodeName]
if !ok {
return 0, false
Expand All @@ -123,6 +132,9 @@ func (n *nodeInfo) getNodeStatusCapacityGPUs() (uint64, bool) {
}

func (n *nodeInfo) getNodeStatusCapacityEfas() (uint64, bool) {
if n.provider == nil {
return 0, false
}
capacityResources, ok := n.provider.NodeToCapacityMap()[n.nodeName]
if !ok {
return 0, false
Expand All @@ -132,6 +144,9 @@ func (n *nodeInfo) getNodeStatusCapacityEfas() (uint64, bool) {
}

func (n *nodeInfo) getNeuronResourceCapacity(resourceKey v1.ResourceName) (uint64, bool) {
if n.provider == nil {
return 0, false
}
capacityResources, ok := n.provider.NodeToCapacityMap()[n.nodeName]
if !ok {
return 0, false
Expand Down Expand Up @@ -184,6 +199,9 @@ func (n *nodeInfo) getNodeStatusCapacityNeuronCores() (uint64, bool) {
}

func (n *nodeInfo) getNodeStatusCondition(conditionType v1.NodeConditionType) (uint64, bool) {
if n.provider == nil {
return 0, false
}
if nodeConditions, ok := n.provider.NodeToConditionsMap()[n.nodeName]; ok {
if conditionStatus, ok := nodeConditions[conditionType]; ok {
if conditionStatus == v1.ConditionTrue {
Expand All @@ -196,6 +214,9 @@ func (n *nodeInfo) getNodeStatusCondition(conditionType v1.NodeConditionType) (u
}

func (n *nodeInfo) getNodeConditionUnknown() (uint64, bool) {
if n.provider == nil {
return 0, false
}
if nodeConditions, ok := n.provider.NodeToConditionsMap()[n.nodeName]; ok {
for _, conditionStatus := range nodeConditions {
if conditionStatus == v1.ConditionUnknown {
Expand Down
34 changes: 18 additions & 16 deletions receiver/awscontainerinsightreceiver/internal/stores/podstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,24 +322,26 @@ func (p *PodStore) refreshInternal(now time.Time, podList []corev1.Pod) {
cpuRequest += tmpCPUReq
tmpMemReq, _ := getResourceSettingForPod(&pod, p.nodeInfo.getMemCapacity(), memoryKey, getRequestForContainer)
memRequest += tmpMemReq
if coresLimit, coresReq, hasNeuron := p.getNeuronCoresFromPod(&pod); hasNeuron {
neuroncoreRequest += coresReq
if pod.Status.Phase == corev1.PodRunning {
neuroncoreUsageTotal += coresLimit
if p.includeEnhancedMetrics && p.enableAcceleratedComputeMetrics {
if coresLimit, coresReq, hasNeuron := p.getNeuronCoresFromPod(&pod); hasNeuron {
neuroncoreRequest += coresReq
if pod.Status.Phase == corev1.PodRunning {
neuroncoreUsageTotal += coresLimit
}
}
}
if tmpGpuLimit, ok := getResourceSettingForPod(&pod, 0, gpuKey, getLimitForContainer); ok {
tmpGpuReq, _ := getResourceSettingForPod(&pod, 0, gpuKey, getRequestForContainer)
gpuRequest += tmpGpuReq
if pod.Status.Phase == corev1.PodRunning {
gpuUsageTotal += tmpGpuLimit
if tmpGpuLimit, ok := getResourceSettingForPod(&pod, 0, gpuKey, getLimitForContainer); ok {
tmpGpuReq, _ := getResourceSettingForPod(&pod, 0, gpuKey, getRequestForContainer)
gpuRequest += tmpGpuReq
if pod.Status.Phase == corev1.PodRunning {
gpuUsageTotal += tmpGpuLimit
}
}
}
if tmpEfaLimit, ok := getResourceSettingForPod(&pod, 0, efaKey, getLimitForContainer); ok {
tmpEfaReq, _ := getResourceSettingForPod(&pod, 0, efaKey, getRequestForContainer)
efaRequest += tmpEfaReq
if pod.Status.Phase == corev1.PodRunning {
efaUsageTotal += tmpEfaLimit
if tmpEfaLimit, ok := getResourceSettingForPod(&pod, 0, efaKey, getLimitForContainer); ok {
tmpEfaReq, _ := getResourceSettingForPod(&pod, 0, efaKey, getRequestForContainer)
efaRequest += tmpEfaReq
if pod.Status.Phase == corev1.PodRunning {
efaUsageTotal += tmpEfaLimit
}
}
}
}
Expand Down
Loading