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 1870622: Update topology list view to be more consistent with workloads page #6188
Bug 1870622: Update topology list view to be more consistent with workloads page #6188
Conversation
997ede0
to
7a06d8f
Compare
7a06d8f
to
07d38e5
Compare
/retest |
07d38e5
to
a58b967
Compare
/retest |
/assign |
@jeff-phillips-18 when the sidebar is open, the cells for memory & cpu usage don't show up. have a look at the below gif |
@debsmita1 Correct. That is by design as in the project workloads tab in the admin perspective. |
verified this locally |
let metricsInterval: any = null; | ||
let monitoringAlertInterval: any = null; | ||
|
||
const fetchMetrics = () => { | ||
if (!PROMETHEUS_TENANCY_BASE_PATH) { | ||
return; | ||
} | ||
|
||
const queries = { | ||
memory: `sum(container_memory_working_set_bytes{namespace='${namespace}',container='',pod!=''}) BY (pod, namespace)`, | ||
cpu: `pod:container_cpu_usage:sum{namespace="${namespace}"}`, | ||
}; | ||
|
||
const promises = _.map(queries, (query, name) => { | ||
const url = `${PROMETHEUS_TENANCY_BASE_PATH}/api/v1/query?namespace=${namespace}&query=${encodeURIComponent( | ||
query, | ||
)}`; | ||
return coFetchJSON(url).then(({ data: { result } }) => { | ||
const byPod: MetricValuesByPod = result.reduce((acc, { metric, value }) => { | ||
acc[metric.pod] = Number(value[1]); | ||
return acc; | ||
}, {}); | ||
return { [name]: byPod }; | ||
}); | ||
}); | ||
|
||
Promise.all(promises) | ||
.then((data) => { | ||
const updatedMetrics = data.reduce( | ||
(acc: OverviewMetrics, metric): OverviewMetrics => _.assign(acc, metric), | ||
{}, | ||
); | ||
updateMetrics(updatedMetrics); | ||
}) | ||
.catch((res) => { | ||
const status = _.get(res, 'response.status'); | ||
// eslint-disable-next-line no-console | ||
console.error('Could not fetch metrics, status:', status); | ||
// Don't retry on some status codes unless a previous request succeeded. | ||
if (_.includes([401, 403, 502, 503], status) && _.isEmpty(metrics)) { | ||
throw new Error(`Could not fetch metrics, status: ${status}`); | ||
} | ||
}) | ||
.then(() => { | ||
metricsInterval = setTimeout(fetchMetrics, METRICS_POLL_INTERVAL); | ||
}) | ||
.catch((e) => { | ||
console.error(e); // eslint-disable-line no-console | ||
}); |
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.
this logic is same as used in Admin side but that's a class based and this is functional connected component https://github.com/openshift/console/blob/master/frontend/public/components/overview/index.tsx#L267 , can we separate it and use across or it'll be beyond scope of this issue WDYT?
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 can look into doing this. Eventually we will be replacing the workloads tab contents with the topology list view and the duplication will be removed (see #6224)
a58b967
to
1b69588
Compare
@jeff-phillips-18: This pull request references Bugzilla bug 1870622, 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. |
/lgtm verified the changes, works as expected |
/assign @christianvogt |
/bugzilla refresh |
@jeff-phillips-18: This pull request references Bugzilla bug 1870622, 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 |
@jeff-phillips-18: This pull request references Bugzilla bug 1870622, which is valid. 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. |
1b69588
to
e0d1ca4
Compare
@invincibleJai squashed and rebased |
Unit test failure related to |
e0d1ca4
to
9c18a70
Compare
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, debsmita1, invincibleJai, jeff-phillips-18 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 |
@jeff-phillips-18: All pull requests linked via external trackers have merged: openshift/console#6188. Bugzilla bug 1870622 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. |
Fixes
https://issues.redhat.com/browse/ODC-4418
Description
Update the topology list view to contain separate cells for memory and cpu metrics. Add polling for metric and alert updates.
Screenshots
Before:
After:
Browser conformance:
/kind bug
cc @openshift/team-devconsole-ux @serenamarie125 @beaumorley @bgliwa01