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

Add differential chart option to charts #1367

Merged
merged 1 commit into from
Jun 7, 2017

Conversation

yaacov
Copy link
Member

@yaacov yaacov commented May 17, 2017

Description

Add rate / differential chart option to charts

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1457893

Motive

Some metrics only come in counter/totals form (especially in Prometheus), we need a rate view to better understand/compare them.

Screenshot
gifrecord_2017-05-18_160027

@yaacov
Copy link
Member Author

yaacov commented May 17, 2017

@miq-bot add_label providers/containers

@simon3z @zakiva @moolitayer @cben @himdel please review

@miq-bot
Copy link
Member

miq-bot commented May 17, 2017

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

@yaacov
Copy link
Member Author

yaacov commented May 17, 2017

@miq-bot add_label compute/containers

@@ -2,6 +2,16 @@ angular.module('miq.util').factory('metricsUtilsFactory', function() {
return function (dash) {
var UNKNOWN_ERROR_STR = __('Something is wrong, try reloading the page');

function dataDiff(data) {
data.forEach(function(v, i) {
if (data[i] && data[i + 1]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@yaacov what if either data[i] or data[i + 1] is really 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 thanks, replaced with explicit !== null

@simon3z
Copy link
Contributor

simon3z commented May 17, 2017

@yaacov at least dataDiff needs tests.

@@ -2,6 +2,16 @@ angular.module('miq.util').factory('metricsUtilsFactory', function() {
return function (dash) {
var UNKNOWN_ERROR_STR = __('Something is wrong, try reloading the page');

function dataDiff(data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@yaacov let's use a less generic name.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 Thanks, replaced with inplaceCalcDataDifferentials :-)

@yaacov yaacov force-pushed the add-diff-option-to-charts branch 2 times, most recently from 15ff186 to 0f0af69 Compare May 17, 2017 15:15
function inplaceCalcDataDifferentials(data) {
data.forEach(function(v, i) {
if ((data[i] !== null) && (data[i + 1] !== null)) {
data[i] = data[i + 1] - data[i];
Copy link
Contributor

Choose a reason for hiding this comment

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

@yaacov I am not sure if we want to do this inplace... wouldn't this function always result in an array where the last item is null?

Copy link
Member Author

Choose a reason for hiding this comment

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

@simon3z

I am not sure if we want to do this inplace

inplace saves memory and pushing data between functions ...

wouldn't this function always result in an array where the last item is null?

yes, each consecutive pair becomes one item, the null is left in the end.

@yaacov yaacov force-pushed the add-diff-option-to-charts branch 5 times, most recently from 2858622 to a31762c Compare May 17, 2017 16:09
@yaacov
Copy link
Member Author

yaacov commented May 18, 2017

Following meeting today, change "Differentials" to "Rate"

cc// @simon3z

@simon3z
Copy link
Contributor

simon3z commented May 22, 2017

@yaacov a couple of comments:

  1. doing an in-place differential seems premature optimization (how many data-points do you expect at max? Arrays of base types should be cheap)
  2. if you keep the original datapoints vs rate in two different variables you can switch back and forth without any interaction with the backend (seems a major advantage for connection that are not fast)

@yaacov yaacov force-pushed the add-diff-option-to-charts branch from 66d706d to 427f90f Compare May 22, 2017 13:47
@yaacov
Copy link
Member Author

yaacov commented May 22, 2017

@simon3z
a. Changed the inplace implementation to regular one :-)
b. Thinking how to do it without reloading ...

@miq-bot
Copy link
Member

miq-bot commented May 25, 2017

This pull request is not mergeable. Please rebase and repush.

@yaacov yaacov force-pushed the add-diff-option-to-charts branch from 427f90f to 1e88372 Compare May 26, 2017 08:40
@yaacov yaacov force-pushed the add-diff-option-to-charts branch from 1e88372 to 36cf08e Compare May 26, 2017 08:49
@yaacov
Copy link
Member Author

yaacov commented May 26, 2017

@simon3z @himdel please re-review

Now redraw does not require a new ajax request.

@yaacov yaacov closed this May 26, 2017
@yaacov yaacov reopened this May 26, 2017
@yaacov
Copy link
Member Author

yaacov commented Jun 1, 2017

@simon3z @himdel please re-review

@simon3z
Copy link
Contributor

simon3z commented Jun 1, 2017

LGTM 👍

@miq-bot assign himdel
cc @himdel

@simon3z
Copy link
Contributor

simon3z commented Jun 1, 2017

@yaacov do we have a BZ for this? If not we should (open one, thanks).

@miq-bot miq-bot assigned himdel and unassigned simon3z Jun 1, 2017
@yaacov
Copy link
Member Author

yaacov commented Jun 1, 2017

do we have a BZ for this? If not we should (open one, thanks).

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1457893

@yaacov
Copy link
Member Author

yaacov commented Jun 4, 2017

@miq-bot add_label fine/yes

https://bugzilla.redhat.com/show_bug.cgi?id=1457893 target 5.8.1

@yaacov
Copy link
Member Author

yaacov commented Jun 6, 2017

@himdel please re-review

@miq-bot
Copy link
Member

miq-bot commented Jun 6, 2017

This pull request is not mergeable. Please rebase and repush.

@yaacov yaacov force-pushed the add-diff-option-to-charts branch from 36cf08e to 7926d7f Compare June 6, 2017 14:48
@himdel
Copy link
Contributor

himdel commented Jun 6, 2017

LGTM 👍 would merge, but seems the JS specs are failing, looks relevant.

@yaacov yaacov force-pushed the add-diff-option-to-charts branch from 7926d7f to 8029d14 Compare June 6, 2017 16:11
@yaacov
Copy link
Member Author

yaacov commented Jun 6, 2017

but seems the JS specs are failing, looks relevant.

@himdel
yes, I wrote unitLable instead of unitLabel in the spec :-)

@yaacov yaacov force-pushed the add-diff-option-to-charts branch from 8029d14 to 0131b20 Compare June 7, 2017 03:29
@miq-bot
Copy link
Member

miq-bot commented Jun 7, 2017

Checked commit yaacov@0131b20 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
0 files checked, 0 offenses detected
Everything looks fine. 🍪

@yaacov
Copy link
Member Author

yaacov commented Jun 7, 2017

@himdel all green now

@himdel himdel merged commit cc24e00 into ManageIQ:master Jun 7, 2017
@himdel himdel added this to the Sprint 63 Ending Jun 19, 2017 milestone Jun 7, 2017
@simaishi
Copy link
Contributor

@yaacov there are a bit of conflicts backporting to Fine. Would you mind creating a Fine PR?

$ git status
On branch fine
Your branch is up-to-date with 'origin/fine'.
You are currently cherry-picking commit cc24e00.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:

	modified:   app/assets/javascripts/controllers/live_metrics/util/metrics-http-factory.js
	modified:   app/views/ems_container/ad_hoc/_chart_view_form.html.haml

Unmerged paths:
  (use "git add <file>..." to mark resolution)

	both modified:   app/assets/javascripts/controllers/live_metrics/ad_hoc_metrics_controller.js
	both modified:   app/assets/javascripts/controllers/live_metrics/util/metrics-utils-factory.js
	both modified:   app/assets/stylesheets/metrics.scss
	both modified:   spec/javascripts/controllers/container_live_dashboard/container_live_dashboard_controller_spec.js

@yaacov
Copy link
Member Author

yaacov commented Jun 20, 2017

@yaacov there are a bit of conflicts backporting to Fine. Would you mind creating a Fine PR?

👍

A Fine PR: #1571

@simaishi
Copy link
Contributor

simaishi commented Aug 4, 2017

Backported to Fine via #1600

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.

5 participants