Skip to content

Commit

Permalink
Fixed legend labeling bug in Prometheus datasource (grafana#4858)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelanford authored and torkelo committed Apr 30, 2016
1 parent 736ee3f commit cbefd8f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion public/app/plugins/datasource/prometheus/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS
var end = getPrometheusTime(options.range.to, true);

var queries = [];
var activeTargets = [];

options = _.clone(options);
_.each(options.targets, _.bind(function(target) {
if (!target.expr || target.hide) {
return;
}
activeTargets.push(target);

var query: any = {};
query.expr = templateSrv.replace(target.expr, options.scopedVars, interpolateQueryExpr);
Expand Down Expand Up @@ -109,7 +112,7 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS
delete self.lastErrors.query;

_.each(response.data.data.result, function(metricData) {
result.push(self.transformMetricData(metricData, options.targets[index], start, end));
result.push(self.transformMetricData(metricData, activeTargets[index], start, end));
});
});

Expand Down

0 comments on commit cbefd8f

Please sign in to comment.