mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 14:09:41 -08:00
Show special float values as gaps.
This commit is contained in:
parent
7de2cf2fce
commit
91da12ad6a
|
@ -385,7 +385,8 @@ Prometheus.Graph.prototype.metricToTsName = function(labels) {
|
||||||
|
|
||||||
Prometheus.Graph.prototype.parseValue = function(value) {
|
Prometheus.Graph.prototype.parseValue = function(value) {
|
||||||
if (value == "NaN" || value == "Inf" || value == "-Inf") {
|
if (value == "NaN" || value == "Inf" || value == "-Inf") {
|
||||||
return 0; // TODO: what should we really do here?
|
// Can't display these values on a graph, so display a gap instead.
|
||||||
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return parseFloat(value);
|
return parseFloat(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,6 +376,15 @@ PromConsole.Graph = function(params) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PromConsole.Graph.prototype._parseValue = function(value) {
|
||||||
|
if (value == "NaN" || value == "Inf" || value == "-Inf") {
|
||||||
|
// Can't display these values on a graph, so display a gap instead.
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return parseFloat(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PromConsole.Graph.prototype._render = function(data) {
|
PromConsole.Graph.prototype._render = function(data) {
|
||||||
var palette = new Rickshaw.Color.Palette();
|
var palette = new Rickshaw.Color.Palette();
|
||||||
var series = [];
|
var series = [];
|
||||||
|
@ -399,7 +408,7 @@ PromConsole.Graph.prototype._render = function(data) {
|
||||||
for (var e = 0; e < data.length; e++) {
|
for (var e = 0; e < data.length; e++) {
|
||||||
for (var i = 0; i < data[e].value.length; i++) {
|
for (var i = 0; i < data[e].value.length; i++) {
|
||||||
series[seriesLen++] = {
|
series[seriesLen++] = {
|
||||||
data: data[e].value[i].values.map(function(s) {return {x: s[0], y: parseFloat(s[1])} }),
|
data: data[e].value[i].values.map(function(s) {return {x: s[0], y: self._parseValue(s[1])} }),
|
||||||
color: palette.color(),
|
color: palette.color(),
|
||||||
name: nameFunc(data[e].value[i].metric),
|
name: nameFunc(data[e].value[i].metric),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue