Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ private static PodMetrics findPodMetric(V1Pod pod, PodMetricsList list) {

public static double podMetricSum(PodMetrics podMetrics, String metricName) {
double sum = 0;
if (podMetrics == null) {
return 0;
}
for (ContainerMetrics containerMetrics : podMetrics.getContainers()) {
Quantity value = containerMetrics.getUsage().get(metricName);
if (value != null) {
Expand Down Expand Up @@ -170,7 +173,11 @@ public int compare(V1Pod arg0, V1Pod arg1) {

List<Pair<ApiType, MetricsType>> result = new ArrayList<>();
for (V1Pod pod : items) {
result.add(new ImmutablePair<>((ApiType) pod, (MetricsType) findPodMetric(pod, metrics)));
PodMetrics podMetrics = findPodMetric(pod, metrics);
if (podMetrics == null) {
continue;
}
result.add(new ImmutablePair<>((ApiType) pod, (MetricsType) podMetrics));
}
return result;
}
Expand Down
Loading