Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 2183915: "No data available" shows on Virtualization overview metrics chart #1257

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions locales/en/plugin__kubevirt-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@
"VM": "VM",
"VMI": "VMI",
"VMs": "VMs",
"VMs in this namespace are new, therefore not enough data is collected to display a graph.": "VMs in this namespace are new, therefore not enough data is collected to display a graph.",
"VNC Address": "VNC Address",
"VNC console": "VNC console",
"VNC Port": "VNC Port",
Expand Down
Original file line number Diff line number Diff line change
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,15 @@ const ChartCard: React.FC<ChartCardProps> = ({ metric }) => {
</span>
) : (
<Bullseye>
<MutedTextSpan text={t('No data available')} />
<MutedTextSpan
text={
isEmpty(chartData)
? t('No data available')
: t(
'VMs in this namespace are new, therefore not enough data is collected to display a graph.',
)
}
/>
</Bullseye>
)}
</GridItem>
Expand Down
Original file line number Diff line number Diff line change
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