Commit 1cbe067b by Torkel Ödegaard

began work on load all metrics (index.json) from graphite into elastic search

parent 8b83f057
......@@ -16,6 +16,43 @@ function (angular, _, config) {
$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()
{
var deferred = $q.defer();
......@@ -57,10 +94,6 @@ function (angular, _, config) {
metricKey: {
properties: {
metricPath: {
/* type: "string",
index: "analyzed",
index_analyzer: "metric_path_ngram"
*/
type: "multi_field",
fields: {
"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) {
var data = result.data;
if (!data || data.length === 0) {
......
......@@ -4,7 +4,7 @@
<div class="row-fluid">
<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>
</div>
</div>
......
......@@ -229,8 +229,8 @@ function (angular, app, $, _, kbn, moment, timeSeries, graphiteSrv, RQ) {
}
};
$scope.typeAheadSource = function (str) {
return ["test", "asd", "testing2" + str];
$scope.typeAheadSource = function () {
return ["test", "asd", "testing2"];
};
$scope.remove_panel_from_row = function(row, panel) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment