Skip to content

Conversation

@pcbailey
Copy link
Contributor

@pcbailey pcbailey commented Jun 14, 2019

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

Loaded card:
OKD - Google Chrome_571

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 14, 2019
@openshift-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 14, 2019
@rawagner rawagner mentioned this pull request Jun 14, 2019
@spadgett
Copy link
Member

Can you add a screenshot?

Copy link
Member

@spadgett spadgett left a 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.

Copy link
Member

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)

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console naming conventions are

Suggested change
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);

Copy link
Member

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

Copy link
Member

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.

Suggested change
const _TopConsumersCard: React.FC<TopConsumerProps> = ({
const TopConsumersCard_: React.FC<TopConsumerProps> = ({

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
openShiftFlag: state[featureReducerName].get(FLAGS.OPENSHIFT),
openshiftFlag: state[featureReducerName].get(FLAGS.OPENSHIFT),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
infraCpuResults,
infraCPUResults,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
workloadCpuResults,
workloadCPUResults,

@spadgett
Copy link
Member

/cc @TheRealJon

@rawagner
Copy link
Contributor

It looks like this PR rewrites a bunch of unit conversions and formatting that we already have elsewhere in console.

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))

@spadgett spadgett added this to the v4.2 milestone Jun 14, 2019
@spadgett
Copy link
Member

/assign

@pcbailey
Copy link
Contributor Author

pcbailey commented Jun 16, 2019

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.

@pcbailey pcbailey force-pushed the add-top-consumers-dashboard-card branch 2 times, most recently from c21ea08 to 883b3b3 Compare June 19, 2019 14:54
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 23, 2019
@pcbailey pcbailey force-pushed the add-top-consumers-dashboard-card branch from 883b3b3 to 7e94f42 Compare July 9, 2019 20:59
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 9, 2019
@rawagner rawagner force-pushed the add-top-consumers-dashboard-card branch 2 times, most recently from d222472 to 37ced5e Compare July 11, 2019 08:08
@rawagner
Copy link
Contributor

rawagner commented Jul 11, 2019

PR updated, here is how it currently looks like
top-consumers

@rawagner rawagner force-pushed the add-top-consumers-dashboard-card branch 2 times, most recently from 2ef31a3 to 7616556 Compare July 11, 2019 08:32
@pcbailey pcbailey changed the title WIP: Add the top consumers card to dashboard Add the top consumers card to dashboard Jul 11, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 11, 2019
@rawagner
Copy link
Contributor

/ok-to-test

@openshift-ci-robot openshift-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jul 11, 2019
@openshift-ci-robot openshift-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 11, 2019
@rawagner rawagner force-pushed the add-top-consumers-dashboard-card branch 2 times, most recently from 44ee6d9 to 0c5cd82 Compare July 13, 2019 10:38
@jelkosz
Copy link

jelkosz commented Jul 15, 2019

/test e2e-aws

@rawagner rawagner force-pushed the add-top-consumers-dashboard-card branch from 0c5cd82 to a452d47 Compare July 16, 2019 13:47
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: extra newline.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: two extra newlines.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Contributor

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 => {
  // ...
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

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,
  };
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

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]

Copy link
Contributor

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

Copy link
Contributor

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 ?

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, makes sense.

Copy link
Contributor

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.

@rawagner rawagner force-pushed the add-top-consumers-dashboard-card branch 2 times, most recently from 17592a8 to 8713d5c Compare July 16, 2019 20:41
@vojtechszocs
Copy link
Contributor

Thanks @rawagner for addressing the review comments.

FYI @TheRealJon Some changes were made to graph components.

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 17, 2019
@rawagner rawagner force-pushed the add-top-consumers-dashboard-card branch from 8713d5c to ceb7d03 Compare July 17, 2019 16:46
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2019
@rawagner rawagner force-pushed the add-top-consumers-dashboard-card branch from ceb7d03 to f9a7c14 Compare July 18, 2019 07:38
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 18, 2019
@atiratree
Copy link
Member

/lgtm

@openshift-ci-robot
Copy link
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 3bcde7c into openshift:master Jul 18, 2019
@pcbailey pcbailey deleted the add-top-consumers-dashboard-card branch October 26, 2022 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants