-
Notifications
You must be signed in to change notification settings - Fork 667
Add the top consumers card to dashboard #1722
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
Add the top consumers card to dashboard #1722
Conversation
|
Hi @pcbailey. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
Can you add a screenshot? |
spadgett
left a comment
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.
It looks like this PR rewrites a bunch of unit conversions and formatting that we already have elsewhere in 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.
We should use consistent case in the descriptions (either title or sentence)
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 the existing utilities we have in units.js? If they aren't sufficient, we should add to those.
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.
console naming conventions are
| export const formatCpu = (cpuTime: string, fixed: number = 0): string => Number(cpuTime).toFixed(fixed); | |
| export const formatCPU = (cpuTime: string, fixed: number = 0): string => Number(cpuTime).toFixed(fixed); |
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.
FYI: we are in the process of migrating Dropdown to PF4 styles
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.
Current console convention is to put the _ at the end.
| const _TopConsumersCard: React.FC<TopConsumerProps> = ({ | |
| const TopConsumersCard_: React.FC<TopConsumerProps> = ({ |
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.
| openShiftFlag: state[featureReducerName].get(FLAGS.OPENSHIFT), | |
| openshiftFlag: state[featureReducerName].get(FLAGS.OPENSHIFT), |
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.
| infraCpuResults, | |
| infraCPUResults, |
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.
| workloadCpuResults, | |
| workloadCPUResults, |
|
/cc @TheRealJon |
right, it needs to sync with #1723 which changes formatting/conversion functions a bit to fit existing use-cases and also new ones (#1723 (comment)) |
|
/assign |
|
Hey, @spadgett. I'm sorry. I should have been clearer that this wasn't ready for your review, yet. I was just posting a very early version so @rawagner could look at it and make sure I wasn't way off track with the changes I've made thus far. That being said, I appreciate you taking the time to review it and I'll make sure to address your comments in my next update and post a screenshot when I have one. |
c21ea08 to
883b3b3
Compare
883b3b3 to
7e94f42
Compare
d222472 to
37ced5e
Compare
2ef31a3 to
7616556
Compare
|
/ok-to-test |
44ee6d9 to
0c5cd82
Compare
|
/test e2e-aws |
0c5cd82 to
a452d47
Compare
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 you explain why is this needed?
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.
Thats actually a little bug if width ref hook which caused issues with chart size. I removed this change a will create a separate PR
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.
proper fix is here #2058
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.
Nit: extra newline.
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.
removed
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.
Nit: two extra newlines.
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.
removed
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.
Nit: no need for a separate pluginItems variable
plugins.registry.getDashboardsOverviewTopConsumerItems().forEach(pluginItem => {
// ...
});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.
fixed
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 can be simplified
if (!topConsumers[pluginItem.properties.name]) {
topConsumers[pluginItem.properties.name] = {
metric: pluginItem.properties.metric,
queries: pluginItem.properties.queries,
mutator: pluginItem.properties.mutator,
};
}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.
done
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.
Please extract repeated expressions as variables
topConsumersMap[type]
metricTypeMap[sortOption]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.
extracted those expressions to variables and reused
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.
Why [key in MetricType]? with the trailing ?
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 I dont add ? then TS is expecting all values of MetricType in queries prop and thats not what I always want ie here https://github.com/openshift/console/pull/1722/files#diff-163991d4c119db922a729100ce2bea7fR27 i dont have MetricType.NETWORK
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.
OK, makes sense.
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.
Actually, we could re-use DashboardsOverviewTopConsumerItem.queries type here, but we can improve it later.
17592a8 to
8713d5c
Compare
|
Thanks @rawagner for addressing the review comments. FYI @TheRealJon Some changes were made to graph components. /lgtm |
8713d5c to
ceb7d03
Compare
ceb7d03 to
f9a7c14
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pcbailey, suomiy, vojtechszocs The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |

This PR adds the top consumers card to the overview dashboard.
Loaded card:
