summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/monitoring/prometheus_graph.js
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-03-28 13:00:00 -0600
committerJose Ivan Vargas <jvargas@gitlab.com>2017-04-03 10:38:16 -0500
commitb4795830026fc1fd361e2dace64a70abeb0cd7ae (patch)
tree74037853e54034fabf98f3033e60caeef5f6a6c3 /app/assets/javascripts/monitoring/prometheus_graph.js
parentdff378d7fe1d8a66c60abb50ebe6d297e09b8820 (diff)
downloadgitlab-ce-b4795830026fc1fd361e2dace64a70abeb0cd7ae.tar.gz
Added a formatRelevantDigits text utility
Diffstat (limited to 'app/assets/javascripts/monitoring/prometheus_graph.js')
-rw-r--r--app/assets/javascripts/monitoring/prometheus_graph.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/assets/javascripts/monitoring/prometheus_graph.js b/app/assets/javascripts/monitoring/prometheus_graph.js
index 17b704e192a..eb9e93dba09 100644
--- a/app/assets/javascripts/monitoring/prometheus_graph.js
+++ b/app/assets/javascripts/monitoring/prometheus_graph.js
@@ -25,7 +25,6 @@ class PrometheusGraph {
this.width = parentContainerWidth - this.margin.left - this.margin.right;
this.height = this.originalHeight - this.margin.top - this.margin.bottom;
this.backOffRequestCounter = 0;
- this.cpuNumberFormatInput = $('input[graph-type="cpu_values"]');
this.configureGraph();
this.init();
}
@@ -271,12 +270,11 @@ class PrometheusGraph {
.attr('y', maxMetricValue + 15)
.text(dayFormat(currentData.time));
- let currentMetricValue = currentData.value;
+ let currentMetricValue = gl.text.formatRelevantDigits(currentData.value);
if (key === 'cpu_values') {
- currentMetricValue = Number(currentMetricValue).toFixed(this.cpuNumberFormatInput.val());
currentMetricValue = `${currentMetricValue}%`;
} else {
- currentMetricValue = currentMetricValue.substring(0, 8);
+ currentMetricValue = `${currentMetricValue} MB`;
}
d3.select(`${currentPrometheusGraphContainer} .text-metric-usage`)
.text(currentMetricValue);