Skip to content

Commit

Permalink
Bug 2183915: "No data available" shows on Virtualization overview met…
Browse files Browse the repository at this point in the history
…rics chart

Signed-off-by: Aviv Turgeman <aturgema@redhat.com>
  • Loading branch information
avivtur committed Apr 18, 2023
1 parent 5ea423e commit 0e8d460
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Expand Up @@ -2,6 +2,7 @@ import React from 'react';

import MutedTextSpan from '@kubevirt-utils/components/MutedTextSpan/MutedTextSpan';
import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation';
import { isEmpty } from '@kubevirt-utils/utils/utils';
import { Bullseye, Card, Grid, GridItem } from '@patternfly/react-core';

import useMetricChartData from '../utils/hooks/useMetricChartData';
Expand Down Expand Up @@ -40,7 +41,13 @@ const ChartCard: React.FC<ChartCardProps> = ({ metric }) => {
</span>
) : (
<Bullseye>
<MutedTextSpan text={t('No data available')} />
<MutedTextSpan
text={t(
isEmpty(chartData)
? 'No data available'
: 'VMs in this namespace are new, therefore not enough data is collected to display a graph.',
)}
/>
</Bullseye>
)}
</GridItem>
Expand Down
Expand Up @@ -8,8 +8,9 @@ const metricQueriesForNamespace = {
[METRICS.VCPU_USAGE]: (namespace) =>
`count(kubevirt_vmi_vcpu_wait_seconds{namespace="${namespace}"})`,
[METRICS.MEMORY]: (namespace) =>
`sum(kubevirt_vmi_memory_available_bytes - kubevirt_vmi_memory_usable_bytes) by (${namespace})`,
[METRICS.STORAGE]: (namespace) => `sum(kubevirt_vmi_filesystem_used_bytes) by (${namespace})`,
`sum by (namespace)(kubevirt_vmi_memory_available_bytes{namespace="${namespace}"} - kubevirt_vmi_memory_usable_bytes{namespace="${namespace}"})`,
[METRICS.STORAGE]: (namespace) =>
`sum by (namespace)(kubevirt_vmi_filesystem_used_bytes{namespace="${namespace}"})`,
};

const metricQueriesForAllNamespaces = {
Expand Down

0 comments on commit 0e8d460

Please sign in to comment.