mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
began work on load all metrics (index.json) from graphite into elastic search
This commit is contained in:
parent
8b83f05796
commit
1cbe067b04
@ -16,6 +16,43 @@ function (angular, _, config) {
|
|||||||
$scope.metricCounter = 0;
|
$scope.metricCounter = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.createIndex = function () {
|
||||||
|
$scope.errorText = null;
|
||||||
|
$scope.infoText = null;
|
||||||
|
|
||||||
|
deleteIndex()
|
||||||
|
.then(createIndex)
|
||||||
|
.then(function () {
|
||||||
|
$scope.infoText = "Index created!";
|
||||||
|
})
|
||||||
|
.then(null, function (err) {
|
||||||
|
$scope.errorText = angular.toJson(err);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.loadMetricsFromPath = function() {
|
||||||
|
$scope.errorText = null;
|
||||||
|
$scope.infoText = null;
|
||||||
|
$scope.metricCounter = 0;
|
||||||
|
|
||||||
|
return loadMetricsRecursive($scope.metricPath)
|
||||||
|
.then(function() {
|
||||||
|
$scope.infoText = "Indexing completed!";
|
||||||
|
}, function(err) {
|
||||||
|
$scope.errorText = "Error: " + err;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.loadAll = function() {
|
||||||
|
return $http.get(config.graphiteUrl + "/metrics/index.json")
|
||||||
|
.then(function (data) {
|
||||||
|
|
||||||
|
})
|
||||||
|
.then(null, function(err) {
|
||||||
|
$scope.errorText = "Failed to fetch index.json metrics file from graphite: " + err;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function deleteIndex()
|
function deleteIndex()
|
||||||
{
|
{
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
@ -57,10 +94,6 @@ function (angular, _, config) {
|
|||||||
metricKey: {
|
metricKey: {
|
||||||
properties: {
|
properties: {
|
||||||
metricPath: {
|
metricPath: {
|
||||||
/* type: "string",
|
|
||||||
index: "analyzed",
|
|
||||||
index_analyzer: "metric_path_ngram"
|
|
||||||
*/
|
|
||||||
type: "multi_field",
|
type: "multi_field",
|
||||||
fields: {
|
fields: {
|
||||||
"metricPath": { type: "string", index: "analyzed", index_analyzer: "standard" },
|
"metricPath": { type: "string", index: "analyzed", index_analyzer: "standard" },
|
||||||
@ -73,33 +106,6 @@ function (angular, _, config) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.createIndex = function () {
|
|
||||||
$scope.errorText = null;
|
|
||||||
$scope.infoText = null;
|
|
||||||
|
|
||||||
deleteIndex()
|
|
||||||
.then(createIndex)
|
|
||||||
.then(function () {
|
|
||||||
$scope.infoText = "Index created!";
|
|
||||||
})
|
|
||||||
.then(null, function (err) {
|
|
||||||
$scope.errorText = angular.toJson(err);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.loadMetricsFromPath = function () {
|
|
||||||
$scope.errorText = null;
|
|
||||||
$scope.infoText = null;
|
|
||||||
$scope.metricCounter = 0;
|
|
||||||
|
|
||||||
return loadMetricsRecursive($scope.metricPath)
|
|
||||||
.then(function() {
|
|
||||||
$scope.infoText = "Indexing completed!";
|
|
||||||
}, function(err) {
|
|
||||||
$scope.errorText = "Error: " + err;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
function receiveMetric(result) {
|
function receiveMetric(result) {
|
||||||
var data = result.data;
|
var data = result.data;
|
||||||
if (!data || data.length === 0) {
|
if (!data || data.length === 0) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<input type="text" ng-model="target.target" class="input-large" style="width:95%" ng-model-onblur ng-change="get_data()" bs-typeahead="typeAheadSource" ata-min-length=0 />
|
<input type="text" ng-model="target.target" class="input-large" style="width:95%" ng-model-onblur ng-change="get_data()" bs-typeahead="typeAheadSource" data-min-length=0 />
|
||||||
<i ng-click="panel.targets = _.without(panel.targets, target)" class="pointer icon-remove" style="position: relative; top: -5px; left: 5px;"></i>
|
<i ng-click="panel.targets = _.without(panel.targets, target)" class="pointer icon-remove" style="position: relative; top: -5px; left: 5px;"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -229,8 +229,8 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv, RQ) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.typeAheadSource = function (str) {
|
$scope.typeAheadSource = function () {
|
||||||
return ["test", "asd", "testing2" + str];
|
return ["test", "asd", "testing2"];
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.remove_panel_from_row = function(row, panel) {
|
$scope.remove_panel_from_row = function(row, panel) {
|
||||||
|
Loading…
Reference in New Issue
Block a user