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

Containers Dashboard: Show hourly and realtime trends #33

Closed
wants to merge 1 commit into from

Conversation

zakiva
Copy link
Contributor

@zakiva zakiva commented Dec 25, 2016

In case that daily trends are not available, we would like to display hourly trends (last 24 hours) if available, or realtime trends (last 10 minutes) instead.
For Image Usage and Pod Creation and Deletion cards I added only hourly trends as we still don't collect the relevant realtime data in the Metric table. This can be added in a follow-up PR once we have the backend functionality.

dashours

@zakiva
Copy link
Contributor Author

zakiva commented Dec 25, 2016

@simon3z @zeari @yaacov @dkorn Please review

@zakiva
Copy link
Contributor Author

zakiva commented Dec 25, 2016

@miq-bot add_label enhancement, providers/containers

@miq-bot
Copy link
Member

miq-bot commented Dec 25, 2016

@zakiva Cannot apply the following label because they are not recognized: providers/containers

@simon3z
Copy link
Contributor

simon3z commented Dec 27, 2016

@zakiva any way to fix the warnings?

@zakiva
Copy link
Contributor Author

zakiva commented Jan 1, 2017

@zakiva any way to fix the warnings?

Fixed most of them.
The long lines used to be longer before this commit and I don't think they can be split.
As for the long methods, I believe they should not be changed: I extracted some of the existing code into helper methods in order to reuse it, so actually they now have less lines.

@zakiva zakiva force-pushed the dashboard branch 2 times, most recently from 9a7a71b to 199fac0 Compare January 2, 2017 11:41
@simon3z
Copy link
Contributor

simon3z commented Jan 2, 2017

@zakiva please have this reviewed. cc @zeari @cben @yaacov @moolitayer

@simon3z
Copy link
Contributor

simon3z commented Jan 2, 2017

@miq-bot assign zakiva

@yaacov
Copy link
Member

yaacov commented Jan 2, 2017

LGTM 👍

p.s.
If you can fix the rubocop things, even if you inherited the warnings from previous code, it will be nicer.

@zeari
Copy link

zeari commented Jan 3, 2017

@himdel Can you take a look here?

"dates",
$scope.memoryUsageConfig.units);
if (data.daily_ems_utilization.cpu != undefined) {
$scope.cpuUsageData = chartsMixin.processUtilizationData(data.daily_ems_utilization.cpu,
Copy link
Contributor

@himdel himdel Jan 3, 2017

Choose a reason for hiding this comment

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

broken formatting, please set your editor to 2 spaces, not 4

(multiple places with the same issue..)

$scope.cpuUsageData = chartsMixin.processUtilizationData(data.hourly_ems_utilization.cpu,
"dates",
$scope.cpuUsageConfig.units);
$scope.cpuUsageConfig.timeFrame = 'Last 24 hours';
Copy link
Contributor

@himdel himdel Jan 3, 2017

Choose a reason for hiding this comment

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

missing i18n .. you probably want __('Last 24 hours') (double underscore)

(multiple places with the same issue..)

@@ -78,7 +78,7 @@
"pf-utilization-trend-chart" => "",
"sparkline-config" => "cpuUsageSparklineConfig"}
%span.trend-footer-pf{"ng-class" => "{ 'chart-transparent-text': !cpuUsageData }"}
= _("Last 30 Days")
= _("{{cpuUsageConfig.timeFrame}}")
Copy link
Contributor

@himdel himdel Jan 3, 2017

Choose a reason for hiding this comment

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

No point in translating "{{cpuUsageConfig.timeFrame}}" .. the only thing this can accomplish is that the translators will break your code ;).

If the actual string is defined in the frontend, you can't very well translate in on the backend..

(multiple places with the same issue..)

@himdel
Copy link
Contributor

himdel commented Jan 3, 2017

Sorry @zakiva , I have skipped reviewing most of the JS code because of broken formatting, please let me know when this is fixed and I'll give it another spin.

But.. from what I can tell, seems like there's too much code duplication.. it seems like you're uselessly copying all the code into both branches of those conditions, instead of simply picking the right field in the if, and keeping the rest of code outside..

Another thing, != undefined feels confusing. Those values are null, not undefined, aren't they? Or maybe you really wanted !==?

@himdel himdel self-assigned this Jan 3, 2017
@Fryguy
Copy link
Member

Fryguy commented Jan 5, 2017

Sorry @zakiva , but I'm going to spam this thread to test the bot. Apologies for the emails.

@Fryguy Fryguy assigned zakiva and unassigned zakiva Jan 5, 2017
@Fryguy
Copy link
Member

Fryguy commented Jan 5, 2017

@miq-bot assign zakiva

@miq-bot
Copy link
Member

miq-bot commented Jan 5, 2017

@Fryguy zakiva is an invalid user, ignoring...

himdel
himdel previously requested changes Jan 6, 2017
Copy link
Contributor

@himdel himdel left a comment

Choose a reason for hiding this comment

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

broken formatting and i18n, see comments please :)

@zakiva zakiva force-pushed the dashboard branch 3 times, most recently from 204c4c2 to 1bd2bf7 Compare January 9, 2017 17:53
@zakiva
Copy link
Contributor Author

zakiva commented Feb 22, 2017

The containerDashboardController (JS) code has too much duplication and inconsistencies:

hourly is assuming xy_data always exists, whereas realtime is assuming it can be null. No idea what daily does, seems the code is now not there (possibly daily doesn't use xy_data?).
you're doing the same data.ems_utilization.xy_data.cpu.xData = data.ems_utilization.xy_data.cpu.xData.map(function (date) { return dashboardUtilsFactory.parseDate(date) }); for cpu and mem, for ems_utilization and network_metrics and pod_metrics and image_metrics.. yet it's the same code in all those if branches - so why not pull it out and do it just once?
server-side code sometimes has a default value for xy_data, sometimes it doesn't (hence the checks for null, presumably)

@himdel I made some fixes: pulled out the date parsing out of the if branches and tried to make the code more consistent and with less code duplication. The data is not necessarily available, server-side code may return daily/hourly/realtime data or no data at all, so I had to check for null before parsing the dates.
I hope the code looks better now, please let me know if there are still fixes to be done.

@zakiva zakiva changed the title [WIP] Containers Dashboard: Show hourly and realtime trends Containers Dashboard: Show hourly and realtime trends Feb 22, 2017
@zakiva
Copy link
Contributor Author

zakiva commented Feb 22, 2017

@miq-bot remove_label wip

@miq-bot miq-bot removed the wip label Feb 22, 2017
@zakiva zakiva force-pushed the dashboard branch 3 times, most recently from 692b81d to 5a75e26 Compare February 23, 2017 13:12
@simon3z
Copy link
Contributor

simon3z commented Feb 27, 2017

@zakiva can you handle the travis failures?

@zakiva zakiva force-pushed the dashboard branch 2 times, most recently from 4cc3968 to 5e8facf Compare February 28, 2017 15:49
@simon3z
Copy link
Contributor

simon3z commented Feb 28, 2017

@zakiva what's the status here?
It seems that Travis is still failing and the review is blocked on a change request by @himdel (still actual?).

@zakiva
Copy link
Contributor Author

zakiva commented Mar 1, 2017

@zakiva what's the status here?
It seems that Travis is still failing and the review is blocked on a change request by @himdel (still actual?).

@simon3z I tried to look into the Travis failures but it seems like they not related to this PR, I also rebased but they are still there :\
As commented above, I made some fixes following the review which I hope resolved all the requested changes. @himdel Can you please take another look?

@simon3z
Copy link
Contributor

simon3z commented Mar 1, 2017

@simon3z I tried to look into the Travis failures but it seems like they not related to this PR, I also rebased but they are still there :\

Recently @cben and @enoodle dealt with unrelated travis failures, maybe they can help here.

@enoodle
Copy link

enoodle commented Mar 1, 2017

@zakiva I had a similar problem - Travis is actually testing a commit not related to the PR (look at the Travis page it writes which commit it tests. it should be a commit merging master and your commit but in this case it is something else entirely). My only solution was to keep rebasing or opening a new PR.

@zakiva zakiva closed this Mar 1, 2017
@zakiva zakiva reopened this Mar 1, 2017
@miq-bot
Copy link
Member

miq-bot commented Mar 1, 2017

Checked commit zakiva@6902ba8 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 4 offenses detected

app/services/container_dashboard_service.rb

@himdel himdel dismissed their stale review March 1, 2017 11:55

fixed

@himdel himdel closed this Mar 1, 2017
@himdel himdel reopened this Mar 1, 2017
@himdel
Copy link
Contributor

himdel commented Mar 1, 2017

Yup, looks like travis is doing it again :( ...

If this is something we want merged soon, @zakiva can you open a new PR please?

(The code looks much more consistent now, thanks! I'll test in the UI and merge if everything works..)

@himdel himdel closed this Mar 1, 2017
@himdel himdel reopened this Mar 1, 2017
@himdel
Copy link
Contributor

himdel commented Mar 1, 2017

(tried to clean travis' cache for this PR and restart the specs, we'll see if that works..)

EDIT: apparently not :( .. so.. the new pr thing..

@himdel
Copy link
Contributor

himdel commented Mar 1, 2017

Also, @zakiva please update the PR description with instructions on how to find the thing in the UI.

EDIT: (although, now that I read the title, "container dashboard" is probably descriptive enough, just not where I expected to find it)

@zakiva
Copy link
Contributor Author

zakiva commented Mar 1, 2017

@himdel @enoodle Thanks, I opened a new PR: #519.
Closing.

@zakiva zakiva closed this Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants