eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ji...@apache.org
Subject incubator-eagle git commit: EAGLE-157 policy metric should be refreshed every minute Today policy metric like evaluation count, alert count etc, is not refreshed in UI in time. We need some frequent refresh for example per minute
Date Fri, 04 Mar 2016 02:55:47 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 2b09be954 -> 1a3b9b086


EAGLE-157 policy metric should be refreshed every minute
Today policy metric like evaluation count, alert count etc, is not refreshed in UI in time.
We need some frequent refresh for example per minute

https://issues.apache.org/jira/browse/EAGLE-157

Author: @zombiej
Reviewer: @qingwen220

Closes #110


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/1a3b9b08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/1a3b9b08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/1a3b9b08

Branch: refs/heads/master
Commit: 1a3b9b0861c0cfb7750e27c94d3a152570cebdfb
Parents: 2b09be9
Author: jiljiang <jiljiang@ebay.com>
Authored: Fri Mar 4 10:55:40 2016 +0800
Committer: jiljiang <jiljiang@ebay.com>
Committed: Fri Mar 4 10:55:40 2016 +0800

----------------------------------------------------------------------
 .../app/public/feature/common/controller.js     | 38 +++++++++++++++-----
 .../app/public/feature/metrics/controller.js    |  2 +-
 eagle-webservice/ui-build.sh                    |  2 --
 3 files changed, 30 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1a3b9b08/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
index bb3155f..c41e8d4 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
+++ b/eagle-webservice/src/main/webapp/app/public/feature/common/controller.js
@@ -109,8 +109,9 @@
 	});
 
 	// ======================= Policy Detail ========================
-	feature.controller('policyDetail', function(PageConfig, Site, $scope, $wrapState, Entities,
Policy, nvd3) {
+	feature.controller('policyDetail', function(PageConfig, Site, $scope, $wrapState, $interval,
Entities, Policy, nvd3) {
 		var MAX_PAGESIZE = 10000;
+		var seriesRefreshInterval;
 
 		PageConfig.pageTitle = "Policy Detail";
 		PageConfig.lockSite = true;
@@ -167,17 +168,28 @@
 				_endTime: _endTime
 			};
 
-			// > eagle.policy.eval.count
-			$scope.policyEvalSeries = nvd3.convert.eagle([Entities.querySeries("GenericMetricService",
$.extend({_metricName: "eagle.policy.eval.count"}, _cond), "@cluster", "sum(value)", 60 *
24)]);
+			function _loadSeries(seriesName, metricName) {
+				var list = Entities.querySeries("GenericMetricService", $.extend({_metricName: metricName},
_cond), "@cluster", "sum(value)", 60 * 24);
+				var seriesList = nvd3.convert.eagle([list]);
+				if(!$scope[seriesName]) $scope[seriesName] = seriesList;
+				list._promise.then(function() {
+					$scope[seriesName] = seriesList;
+				});
+			}
 
-			// > eagle.policy.eval.fail.count
-			$scope.policyEvalFailSeries = nvd3.convert.eagle([Entities.querySeries("GenericMetricService",
$.extend({_metricName: "eagle.policy.eval.fail.count"}, _cond), "@cluster", "sum(value)",
60 * 24)]);
+			function refreshSeries() {
+				// > eagle.policy.eval.count
+				_loadSeries("policyEvalSeries", "eagle.policy.eval.count");
 
-			// > eagle.alert.count
-			$scope.alertSeries = nvd3.convert.eagle([Entities.querySeries("GenericMetricService",
$.extend({_metricName: "eagle.alert.count"}, _cond), "@cluster", "sum(value)", 60 * 24)]);
+				// > eagle.policy.eval.fail.count
+				_loadSeries("policyEvalFailSeries", "eagle.policy.eval.fail.count");
 
-			// > eagle.alert.fail.count
-			$scope.alertFailSeries = nvd3.convert.eagle([Entities.querySeries("GenericMetricService",
$.extend({_metricName: "eagle.alert.fail.count"}, _cond), "@cluster", "sum(value)", 60 * 24)]);
+				// > eagle.alert.count
+				_loadSeries("alertSeries", "eagle.alert.count");
+
+				// > eagle.alert.fail.count
+				_loadSeries("alertFailSeries", "eagle.alert.fail.count");
+			}
 
 			// Alert list
 			$scope.alertList = Entities.queryEntities("AlertService", {
@@ -188,6 +200,9 @@
 				_duration: 1000 * 60 * 60 * 24 * 30,
 				__ETD: 1000 * 60 * 60 * 24
 			});
+
+			refreshSeries();
+			seriesRefreshInterval = $interval(refreshSeries, 60000);
 		});
 
 		// Function
@@ -197,6 +212,11 @@
 				location.href = "#/common/policyList";
 			});
 		};
+
+		// Clean up
+		$scope.$on('$destroy', function() {
+			$interval.cancel(seriesRefreshInterval);
+		});
 	});
 
 	// ======================== Policy Edit =========================

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1a3b9b08/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
----------------------------------------------------------------------
diff --git a/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js b/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
index 5ec9b95..27faf07 100644
--- a/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
+++ b/eagle-webservice/src/main/webapp/app/public/feature/metrics/controller.js
@@ -192,7 +192,7 @@
 					$scope.tabHolder.setSelect(holder.entity.name);
 				}, 0);
 			});
-		}
+		};
 
 		function deleteGroup() {
 			var group = $scope.tabHolder.selectedPane.data;

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1a3b9b08/eagle-webservice/ui-build.sh
----------------------------------------------------------------------
diff --git a/eagle-webservice/ui-build.sh b/eagle-webservice/ui-build.sh
index 6256327..9e4f75c 100644
--- a/eagle-webservice/ui-build.sh
+++ b/eagle-webservice/ui-build.sh
@@ -38,5 +38,3 @@ npm install
 # grunt build
 echo "grunt building..."
 npm run grunt
-
-echo "================ Web APP Building End ================"
\ No newline at end of file


Mime
View raw message