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 1810535: Independent Dashboard is not showing correct metrics. #4583
Conversation
@@ -27,6 +30,10 @@ const ERROR: DataState = { | |||
|
|||
const getErrorText = (text: string) => <span className="im-install-page--error">{text}</span>; | |||
|
|||
const mapDispatchToProps = (dispatch: Dispatch): MapDispatchToProps => ({ | |||
enableDashboard: () => dispatch(setFlag(OCS_INDEPENDENT_FLAG, true)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So after creating the cluster, we have dashboard enabled ?
If I got right, why this change ?
e0d2a9d
to
3c17422
Compare
@bipuladh: This pull request references Bugzilla bug 1810535, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
1 similar comment
@bipuladh: This pull request references Bugzilla bug 1810535, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/bugzilla refresh |
@bipuladh: This pull request references Bugzilla bug 1810535, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
import * as React from 'react'; | ||
import { Grid, GridItem } from '@patternfly/react-core'; | ||
import { Humanize } from '@console/internal/components/utils'; | ||
import { K8sKind } from '@console/internal/module/k8s'; | ||
import { addAvailable, StackDataPoint } from './utils'; | ||
import { BreakdownChart } from './breakdown-chart'; | ||
import { BreakdownChartLoading } from './breakdown-loading'; | ||
import { TotalCapacityBody } from './breakdown-capacity'; | ||
|
||
export const BreakdownCardBody: React.FC<BreakdownBodyProps> = ({ | ||
top5MetricsStats, | ||
metricTotal, | ||
metricModel, | ||
humanize, | ||
isLoading, | ||
hasLoadError, | ||
ocsVersion = '', | ||
}) => { | ||
if (isLoading && !hasLoadError) { | ||
return <BreakdownChartLoading />; | ||
} | ||
if (!top5MetricsStats.length || hasLoadError) { | ||
return <div className="text-secondary">Not available</div>; | ||
} | ||
if (metricTotal === '0') { | ||
return <div className="text-secondary">Not enough usage data</div>; | ||
} | ||
|
||
const usedCapacity = `${humanize(metricTotal).string} used`; | ||
|
||
const chartData = addAvailable(top5MetricsStats, null, null, metricTotal, humanize); | ||
|
||
const legends = chartData.map((d: StackDataPoint) => ({ | ||
name: [d.name, d.label], | ||
labels: { fill: d.color }, | ||
symbol: { fill: d.fill }, | ||
link: d.link, | ||
ns: d.ns, | ||
})); | ||
|
||
return ( | ||
<Grid> | ||
<GridItem span={4}> | ||
<TotalCapacityBody value={usedCapacity} /> | ||
</GridItem> | ||
<GridItem span={4} /> | ||
<GridItem span={12}> | ||
<BreakdownChart | ||
data={chartData} | ||
legends={legends} | ||
metricModel={metricModel} | ||
ocsVersion={ocsVersion} | ||
/> | ||
</GridItem> | ||
</Grid> | ||
); | ||
}; | ||
|
||
type BreakdownBodyProps = { | ||
isLoading: boolean; | ||
hasLoadError: boolean; | ||
metricTotal: string; | ||
top5MetricsStats: StackDataPoint[]; | ||
metricModel: K8sKind; | ||
humanize: Humanize; | ||
ocsVersion?: string; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can actually reuse the existing component. You dont need capacityTotal
for independent mode, and that is already optional for BreakdownBody.
Also just like noobaa, capacity total === metricTotal here.
Refer:
Lines 111 to 119 in f051348
<BreakdownCardBody | |
isLoading={queriesDataLoaded} | |
hasLoadError={queriesLoadError} | |
top5MetricsStats={top5MetricsStats} | |
capacityUsed={objectUsed} | |
metricTotal={objectUsed} | |
metricModel={model} | |
humanize={humanize} | |
ocsVersion={ocsVersion} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@afreen23 the problem lies with used capacity. I couldn't see a workaround it. Do you have any suggestions around it?
export const getClusterHealth = (cluster: K8sResourceKind, loaded: boolean, error): HealthState => { | ||
const phase = cluster?.status?.phase; | ||
if (!_.isEmpty(error)) { | ||
if (error?.response?.status === 404) return HealthState.UNKNOWN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (error?.response?.status === 404) return HealthState.UNKNOWN; | |
if (error?.response?.status === 404) return HealthState.NOTAVAILABLE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But OCS Operator is available the storage cluster endpoint is not available,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be the status of independent mode cluster. We need not to see wrt operator status, whose status is shown on overview status card
<BreakdownCardBody | ||
isLoading={queriesDataLoaded} | ||
hasLoadError={queriesLoadError} | ||
metricTotal={metricTotal} | ||
top5MetricsStats={top5MetricsStats} | ||
metricModel={model} | ||
humanize={humanize} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<BreakdownCardBody | |
isLoading={queriesDataLoaded} | |
hasLoadError={queriesLoadError} | |
metricTotal={metricTotal} | |
top5MetricsStats={top5MetricsStats} | |
metricModel={model} | |
humanize={humanize} | |
<BreakdownCardBody | |
isLoading={queriesDataLoaded} | |
hasLoadError={queriesLoadError} | |
metricTotal={metricTotal} | |
top5MetricsStats={top5MetricsStats} | |
capacityUsed={metricTotal} | |
metricModel={model} | |
humanize={humanize} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
const top6MetricsData = getInstantVectorStats(results[0], metric); | ||
const top5SortedMetricsData = sortInstantVectorStats(top6MetricsData); | ||
const top5MetricsStats = getStackChartStats(top5SortedMetricsData, humanize); | ||
const metricTotal = _.get(results[1], 'data.result[0].value[1]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use optional chaining over here?
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bipuladh, cloudbehl The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
@bipuladh: All pull requests linked via external trackers have merged. Bugzilla bug 1810535 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cherrypick release-4.4 |
@bipuladh: new pull request created: #4674 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
enabled
toenable