Project

General

Profile

Bug #8853

Calamari legend for "Pools Total Disk Free" is wrong

Added by Alexandre Marangone over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
UI
Target version:
-
% Done:

0%

Source:
Community (user)
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Crash signature (v1):
Crash signature (v2):

Description

There is an issue with the legend for the Pools Total Disk Free in Calamari.

Legend is reporting: Available: 3.03 G, Used: 560.4k
ceph -s is reporting: 572 MB used, 3107 GB avail

Checked throughout the UI, all other size reports seem correct.

Associated revisions

Revision ffd8dfca (diff)
Added by Dan Mick over 9 years ago

Fix Pools Total Disk Free graph to display bytes rather than kB

Ceph returns disk amounts in kB (i.e. divided by 1024). Scale back
up by adding the graphite function scale(..,1024) to the template.

Fixes: #8853
Signed-off-by: John Spray <>
Reviewed-by: Dan Mick <>

History

#1 Updated by Dan Mick over 9 years ago

Yikes, k vs M, and TB vs GB....argh

#2 Updated by Dan Mick over 9 years ago

  • Status changed from New to 12

Yes, ceph reports these numbers in kB, and thus so does Diamond, and thus so does the UI. John and I discussed and agree the right place to fix is the UI code, but it's beyond my powers of JS at the moment.

#3 Updated by John Spray over 9 years ago

It should be as simple as this (untested):

diff --git a/dashboard/app/scripts/templates/graphite/PoolDiskFreeTarget.ejs b/d
index 55db04d..a9eed57 100644
--- a/dashboard/app/scripts/templates/graphite/PoolDiskFreeTarget.ejs
+++ b/dashboard/app/scripts/templates/graphite/PoolDiskFreeTarget.ejs
@@ -1 +1 @@
-ceph.cluster.<%- clusterName %>.df.<%- metric %>
+scale(ceph.cluster.<%- clusterName %>.df.<%- metric %>,1024)

#4 Updated by Ian Colle over 9 years ago

  • Project changed from ICE to Calamari
  • Subject changed from ICE 1.2: Calamari legend for "Pools Total Disk Free" is wrong to Calamari legend for "Pools Total Disk Free" is wrong

#5 Updated by Dan Mick over 9 years ago

Yan claims it's not as easy as that, because the graphs are rendered by dygraph. He's got a patch that I've yet to test:


Signed-off-by: Yan-Fa Li <yanfali@gmail.com>
---
 dashboard/app/scripts/helpers/graph-utils.js  |  7 +++++--
 dashboard/app/scripts/views/graphwall-view.js | 10 +++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/dashboard/app/scripts/helpers/graph-utils.js b/dashboard/app/scripts/helpers/graph-utils.js
index 65fbf08..556e825 100644
--- a/dashboard/app/scripts/helpers/graph-utils.js
+++ b/dashboard/app/scripts/helpers/graph-utils.js
@@ -149,14 +149,17 @@ define(['jquery', 'underscore', 'backbone', 'templates'], function($, _, backbon

         // **graphiteJsonArrayToDygraph**
         // Convert JSON output from Graphite into data Dygraph can use.
-        graphiteJsonArrayToDygraph: function(resp) {
+        graphiteJsonArrayToDygraph: function(resp, scaling) {
             // convert time which is usually the first part of a series tuple
+            if (scaling === undefined) {
+                scaling = 1;
+            }
             var data = _.map(resp.datapoints, function(series) {
                 return _.map(series, function(value, index) {
                     if (index === 0) {
                         return new Date(value * 1000);
                     }
-                    return value;
+                    return value * scaling;
                 });
             });
             return {
diff --git a/dashboard/app/scripts/views/graphwall-view.js b/dashboard/app/scripts/views/graphwall-view.js
index 4cbc21e..8fcc62e 100644
--- a/dashboard/app/scripts/views/graphwall-view.js
+++ b/dashboard/app/scripts/views/graphwall-view.js
@@ -245,6 +245,7 @@ define(['jquery', 'underscore', 'backbone', 'templates', 'helpers/graph-utils',
                 util: 'makePoolDiskFreeTargets',
                 titleTemplate: 'TitleGraphPoolTotalDiskFree',
                 options: {
+                    scalingFactor: 1024,
                     labelsKMG2: true,
                     ylabel: 'Bytes',
                     labels: ['Date', 'Available', 'Used'],
@@ -775,7 +775,11 @@ define(['jquery', 'underscore', 'backbone', 'templates', 'helpers/graph-utils',
                 // Convert the graphite data into Dygraph data.
                 // Run it after the call stack has cleared to avoid
                 // slowing down the UI too much.
-                d.resolve(gutils.graphiteJsonArrayToDygraph(resp));
+                var scaling = 1;
+                if (overrides.scalingFactor) {
+                    scaling = overrides.scalingFactor;
+                }
+                d.resolve(gutils.graphiteJsonArrayToDygraph(resp, scaling));
             });
             d.promise().done(function(post) {
                 // One the source data has been processed setup
-- 
2.0.1

and also notes that it may need protection from the data being numeric, perhaps

_.isNumber(value)

#6 Updated by John Spray over 9 years ago

Just tested my one liner, it works fine. I think it is better to just do this scaling as part of the graphite query than to complicate the javascript any further.

#7 Updated by Dan Mick over 9 years ago

Now that I finally understand how that fix works and what it does, that does seem like a much lower-risk and higher-efficiency fix.

#8 Updated by Dan Mick over 9 years ago

Tested on trusty build; works fine.

#9 Updated by Dan Mick over 9 years ago

  • Category set to UI
  • Status changed from 12 to Fix Under Review
  • Assignee set to Dan Mick
  • Source changed from Support to Community (user)

#10 Updated by John Spray over 9 years ago

  • Status changed from Fix Under Review to Resolved

Merged.

Also available in: Atom PDF