mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Modified metricKeys to handle multiple graphite sources.
This wasn't all too hard to change, I mostly changed the single http get to multiple http gets, one for each data source of type graphite. It's still not a good idea to call this on the web frontend, since the whole thing was working for about 20 - 30 minutes when I clicked it, so I'm not committing my changes to settings.js or the view itself.
This commit is contained in:
parent
061bfffd4d
commit
637c720de5
@ -52,14 +52,16 @@ function (angular, _, config) {
|
|||||||
$scope.loadAll = function() {
|
$scope.loadAll = function() {
|
||||||
$scope.infoText = "Fetching all metrics from graphite...";
|
$scope.infoText = "Fetching all metrics from graphite...";
|
||||||
|
|
||||||
return $http.get(config.graphiteUrl + "/metrics/index.json")
|
return $q.all( _.map( config.datasources, function( datasource ) {
|
||||||
.then(saveMetricsArray)
|
if ( datasource.type = 'graphite' ) {
|
||||||
.then(function () {
|
return $http.get( datasource.url + "/metrics/index.json" )
|
||||||
|
.then( saveMetricsArray );
|
||||||
|
}
|
||||||
|
} ) ).then( function() {
|
||||||
$scope.infoText = "Indexing complete!";
|
$scope.infoText = "Indexing complete!";
|
||||||
})
|
}).then(null, function(err) {
|
||||||
.then(null, function(err) {
|
|
||||||
$scope.errorText = err;
|
$scope.errorText = err;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function saveMetricsArray(data, currentIndex)
|
function saveMetricsArray(data, currentIndex)
|
||||||
@ -155,6 +157,7 @@ function (angular, _, config) {
|
|||||||
function saveMetricKey(metricId) {
|
function saveMetricKey(metricId) {
|
||||||
|
|
||||||
// Create request with id as title. Rethink this.
|
// Create request with id as title. Rethink this.
|
||||||
|
console.log( config.grafana_metrics_index, metricId );
|
||||||
var request = $scope.ejs.Document(config.grafana_metrics_index, 'metricKey', metricId).source({
|
var request = $scope.ejs.Document(config.grafana_metrics_index, 'metricKey', metricId).source({
|
||||||
metricPath: metricId
|
metricPath: metricId
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user