mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added filtering support for graphite events/metrics, Closes #402
This commit is contained in:
parent
d2a342a94e
commit
14f09e3787
@ -29,13 +29,11 @@ function (angular, $, kbn, _) {
|
|||||||
this.loader = data.loader || {};
|
this.loader = data.loader || {};
|
||||||
|
|
||||||
_.defaults(this.loader, {
|
_.defaults(this.loader, {
|
||||||
save_gist: false,
|
|
||||||
save_elasticsearch: true,
|
save_elasticsearch: true,
|
||||||
save_default: true,
|
save_default: true,
|
||||||
save_temp: true,
|
save_temp: true,
|
||||||
save_temp_ttl_enable: true,
|
save_temp_ttl_enable: true,
|
||||||
save_temp_ttl: '30d',
|
save_temp_ttl: '30d',
|
||||||
load_gist: false,
|
|
||||||
load_elasticsearch: true,
|
load_elasticsearch: true,
|
||||||
hide: false
|
hide: false
|
||||||
});
|
});
|
||||||
|
@ -40,7 +40,7 @@ define([
|
|||||||
},
|
},
|
||||||
|
|
||||||
applyTemplateToTarget: function(target) {
|
applyTemplateToTarget: function(target) {
|
||||||
if (target.indexOf('[[') === -1) {
|
if (!target || target.indexOf('[[') === -1) {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +63,10 @@ function (angular, _, $, config, kbn, moment) {
|
|||||||
GraphiteDatasource.prototype.annotationQuery = function(annotation, filterSrv, rangeUnparsed) {
|
GraphiteDatasource.prototype.annotationQuery = function(annotation, filterSrv, rangeUnparsed) {
|
||||||
// Graphite metric as annotation
|
// Graphite metric as annotation
|
||||||
if (annotation.target) {
|
if (annotation.target) {
|
||||||
|
var target = filterSrv.applyTemplateToTarget(annotation.target);
|
||||||
var graphiteQuery = {
|
var graphiteQuery = {
|
||||||
range: rangeUnparsed,
|
range: rangeUnparsed,
|
||||||
targets: [{ target: annotation.target }],
|
targets: [{ target: target }],
|
||||||
format: 'json',
|
format: 'json',
|
||||||
maxDataPoints: 100
|
maxDataPoints: 100
|
||||||
};
|
};
|
||||||
@ -93,17 +94,19 @@ function (angular, _, $, config, kbn, moment) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Graphite event as annotation
|
// Graphite event as annotation
|
||||||
else if (annotation.tags) {
|
else {
|
||||||
return this.events({ range: rangeUnparsed, tags: annotation.tags })
|
var tags = filterSrv.applyTemplateToTarget(annotation.tags);
|
||||||
|
return this.events({ range: rangeUnparsed, tags: tags })
|
||||||
.then(function(results) {
|
.then(function(results) {
|
||||||
var list = [];
|
var list = [];
|
||||||
for (var i = 0; i < results.data; i++) {
|
for (var i = 0; i < results.data.length; i++) {
|
||||||
|
var e = results.data[i];
|
||||||
list.push({
|
list.push({
|
||||||
annotation: annotation,
|
annotation: annotation,
|
||||||
time: event.when * 1000,
|
time: e.when * 1000,
|
||||||
title: event.what,
|
title: e.what,
|
||||||
tags: event.tags,
|
tags: e.tags,
|
||||||
text: event.data
|
text: e.data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
@ -22,7 +22,7 @@ function(angular, _, config) {
|
|||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
self.original = angular.copy(newDashboard);
|
self.original = angular.copy(newDashboard);
|
||||||
self.current = newDashboard;
|
self.current = newDashboard;
|
||||||
}, 1000);
|
}, 1200);
|
||||||
});
|
});
|
||||||
|
|
||||||
$rootScope.$on("dashboard-saved", function(event, savedDashboard) {
|
$rootScope.$on("dashboard-saved", function(event, savedDashboard) {
|
||||||
|
Loading…
Reference in New Issue
Block a user