Add analytics events

This commit is contained in:
denz
2015-04-20 14:48:43 +09:00
parent 9980fe5ae1
commit fdd06f4506
21 changed files with 144 additions and 9 deletions
@@ -523,6 +523,7 @@ var BigScatterChart = $.Class({
sYMax = sPrefix + 'ymax';
var fConfigToggle = function (e) {
$at($at.MAIN, $at.CLK_SCATTER_SETTING);
self._welConfigBg.toggle();
self._welConfigLayer.toggle();
$('#' + sYMin).val(self.option('nYMin'));
@@ -593,6 +594,7 @@ var BigScatterChart = $.Class({
// download
var fDownloadToggle = function (e) {
$at($at.MAIN, $at.CLK_DOWNLOAD_SCATTER);
var sImageUrl = self.getChartAsPNG();
// document.location.href = sImageUrl.replace("image/png", "image/octet-stream");
$(this).attr({
@@ -655,6 +657,12 @@ var BigScatterChart = $.Class({
var htCheckBoxImage = this.option('htCheckBoxImage');
_.each(this._htwelTypeLi, function (welTypeLi, sKey) {
welTypeLi.click(function (e) {
if ( sKey === "Success" ) {
$at($at.MAIN, $at.TG_SCATTER_SUCCESS, welTypeLi.hasClass('unchecked') ? $at.ON : $at.OFF );
} else {
$at($at.MAIN, $at.TG_SCATTER_FAILED, welTypeLi.hasClass('unchecked') ? $at.ON : $at.OFF );
}
e.preventDefault();
self._htwelChartCanvas[sKey].toggle();
if (!welTypeLi.hasClass('unchecked')) {
@@ -512,6 +512,7 @@
margin: 2,
visible : false,
click: function(e, o) {
$at($at.MAIN, $at.TG_NODE_VIEW);
e.bubbles = false;
var isCollapse = o.part.data.isCollapse;
self._oDiagram.model.setDataProperty( o.part.data, "isCollapse", !isCollapse );
@@ -1154,6 +1155,7 @@
var node = obj.part,
fOnNodeSubGroupClicked = this.option('fOnNodeSubGroupClicked');
if (_.isFunction(fOnNodeSubGroupClicked)) {
$at($at.MAIN, $at.CLK_NODE);
fOnNodeSubGroupClicked.call(this, e, node, unknownKey, fromName);
}
},
@@ -1170,6 +1172,7 @@
htData = node.data,
fOnNodeClicked = this.option('fOnNodeClicked');
if (_.isFunction(fOnNodeClicked)) {
$at($at.MAIN, $at.CLK_NODE);
fOnNodeClicked.call(this, e, htData, unknownKey, query);
}
},
@@ -1217,6 +1220,7 @@
htData = link.data,
fOnLinkClicked = this.option('fOnLinkClicked');
if (_.isFunction(fOnLinkClicked)) {
$at($at.MAIN, $at.CLK_LINK);
htData.fromNode = obj.fromNode.part.data;
htData.toNode = obj.toNode.part.data;
fOnLinkClicked.call(this, e, htData);
+1
View File
@@ -111,6 +111,7 @@
<!-- analytics -->
<script src="scripts/extra/google-analytics.js"></script>
<script src="scripts/extra/event-analytics.js"></script>
<!-- end -->
</head>
<body ng-app="pinpointApp">
@@ -2,7 +2,7 @@
pinpointApp.controller('FilteredMapCtrl', [ 'filterConfig', '$scope', '$routeParams', '$timeout', 'TimeSliderVo', 'NavbarVo', 'encodeURIComponentFilter', '$window', 'SidebarTitleVo', 'filteredMapUtil', '$rootElement',
function (cfg, $scope, $routeParams, $timeout, TimeSliderVo, NavbarVo, encodeURIComponentFilter, $window, SidebarTitleVo, filteredMapUtil, $rootElement) {
$at($at.FILTEREDMAP_PAGE);
// define private variables
var oNavbarVo, oTimeSliderVo, bNodeSelected, bNoData, reloadOnlyForNode, reloadOnlyForLink;
@@ -2,7 +2,7 @@
pinpointApp.controller('InspectorCtrl', [ '$scope', '$timeout', '$routeParams', 'location', 'NavbarVo',
function ($scope, $timeout, $routeParams, location, NavbarVo) {
$at($at.INSPECTOR_PAGE);
// define private variables
var oNavbarVo, oAgent;
@@ -2,7 +2,7 @@
pinpointApp.controller('MainCtrl', [ 'filterConfig', '$scope', '$timeout', '$routeParams', 'location', 'NavbarVo', 'encodeURIComponentFilter', '$window', 'SidebarTitleVo', 'filteredMapUtil', '$rootElement', 'helpContent',
function (cfg, $scope, $timeout, $routeParams, location, NavbarVo, encodeURIComponentFilter, $window, SidebarTitleVo, filteredMapUtil, $rootElement, helpContent) {
$at($at.MAIN_PAGE);
// define private variables
var oNavbarVo, bNodeSelected, bNoData;
@@ -353,6 +353,7 @@ pinpointApp.controller('MainCtrl', [ 'filterConfig', '$scope', '$timeout', '$rou
* on after overlay creation
*/
$scope.onAfterOverlayCreation = function () {
$at($at.MAIN, $at.CLK_HELP);
$rootElement.find('#copyright').show();
};
@@ -2,7 +2,7 @@
pinpointApp.controller('ScatterFullScreenModeCtrl', [ '$scope', '$rootScope', '$routeParams', '$timeout', 'NavbarVo',
function ($scope, $rootScope, $routeParams, $timeout, NavbarVo) {
$at($at.SCATTER_FULL_SCREEN_PAGE);
// define private variables
var oNavbarVo;
@@ -5,7 +5,7 @@ pinpointApp.constant('TransactionDetailConfig', {
pinpointApp.controller('TransactionDetailCtrl', ['TransactionDetailConfig', '$scope', '$rootScope', '$routeParams', '$timeout', '$rootElement', 'Alerts', 'ProgressBar', 'TransactionDao', '$window', '$location',
function (cfg, $scope, $rootScope, $routeParams, $timeout, $rootElement, Alerts, ProgressBar, TransactionDao, $window, $location) {
$at($at.TRANSACTION_DETAIL_PAGE);
// define private variables
var oAlert, oProgressBar, bShowCallStacksOnce;
@@ -97,6 +97,7 @@ pinpointApp.controller('TransactionDetailCtrl', ['TransactionDetailConfig', '$sc
$window.open('/#/transactionView/' + $scope.transactionDetail.agentId + '/' + $scope.transactionDetail.transactionId + '/' + $scope.transactionDetail.callStackStart);
};
$scope.$on("transactionDetail.selectDistributedCallFlowRow", function( event, rowId ) {
$at($at.CALLSTACK, $at.CLK_DISTRIBUTED_CALL_FLOW);
$("#traceTabs li:nth-child(1) a").trigger("click");
$scope.$broadcast('distributedCallFlow.selectRow.forTransactionDetail', rowId);
});
@@ -106,9 +107,11 @@ pinpointApp.controller('TransactionDetailCtrl', ['TransactionDetailConfig', '$sc
e.preventDefault();
});
$("#traceTabs li:nth-child(2) a").bind("click", function (e) {
$at($at.CALLSTACK, $at.CLK_SERVER_MAP);
$scope.$broadcast('serverMap.initializeWithMapData', $scope.transactionDetail);
});
$("#traceTabs li:nth-child(3) a").bind("click", function (e) {
$at($at.CALLSTACK, $at.CLK_RPC_TIMELINE);
$scope.$broadcast('timeline.initialize', $scope.transactionDetail);
});
@@ -13,7 +13,7 @@ pinpointApp.constant('TransactionListConfig', {
pinpointApp.controller('TransactionListCtrl', ['TransactionListConfig', '$scope', '$routeParams', '$rootScope', '$timeout', '$window', '$http', 'webStorage', 'TimeSliderVo', 'encodeURIComponentFilter', 'TransactionDao',
function (cfg, $scope, $routeParams, $rootScope, $timeout, $window, $http, webStorage, TimeSliderVo, encodeURIComponentFilter, oTransactionDao) {
$at($at.TRANSACTION_LIST_PAGE);
// define private variables
var nFetchCount, nLastFetchedIndex, htTransactionInfo, htTransactionData, oTimeSliderVo;
@@ -6,7 +6,7 @@ pinpointApp.constant('TransactionViewConfig', {
pinpointApp.controller('TransactionViewCtrl', [ 'TransactionViewConfig', '$scope', '$rootScope', '$rootElement', 'Alerts', 'ProgressBar', '$timeout', '$routeParams', 'TransactionDao', 'AgentDao',
function (cfg, $scope, $rootScope, $rootElement, Alerts, ProgressBar, $timeout, $routeParams, TransactionDao, AgentDao) {
$at($at.TRANSACTION_VIEW_PAGE);
// define private variables
var oAlert, oProgressBar;
@@ -55,6 +55,7 @@ pinpointApp.directive('agentChartGroup', [ 'agentChartGroupConfig', '$timeout',
activate: function (event, ui) {
var activatedTabText = ui.newTab.text();
if (activatedTabText == 'Heap') {
$at($at.MIXEDVIEW, $at.CLK_HEAP);
if (htChartCache.Heap === false) {
showHeapChart(htLastAgentStat);
} else {
@@ -62,6 +63,7 @@ pinpointApp.directive('agentChartGroup', [ 'agentChartGroupConfig', '$timeout',
}
return;
} else if (activatedTabText == 'PermGen') {
$at($at.MIXEDVIEW, $at.CLK_PERM_GEN);
if (htChartCache.PermGen === false) {
showPermGenChart(htLastAgentStat);
} else {
@@ -69,6 +71,7 @@ pinpointApp.directive('agentChartGroup', [ 'agentChartGroupConfig', '$timeout',
}
return;
} else if (activatedTabText == 'CpuLoad') {
$at($at.MIXEDVIEW, $at.CLK_CPU_LOAD);
if (htChartCache.CpuLoad === false) {
showCpuLoadChart(htLastAgentStat);
} else {
@@ -159,6 +159,9 @@ pinpointApp
};
}
oChart = AmCharts.makeChart(id, options);
oChart.addListener("clickGraph", function(e) {
$at($at.MAIN, $at.CLK_LOAD_GRAPH);
});
});
};
@@ -337,6 +337,7 @@ pinpointApp.directive('navbar', [ 'cfg', '$rootScope', '$http',
return m;
}
}).on("change", function (e) {
$at( $at.MAIN, $at.CLK_APPLICATION );
scope.application = e.val;
scope.$digest();
broadcast();
@@ -357,6 +358,7 @@ pinpointApp.directive('navbar', [ 'cfg', '$rootScope', '$http',
* @param readablePeriod
*/
scope.setPeriod = function (readablePeriod) {
$at($at.MAIN, $at.CLK_TIME, readablePeriod);
scope.periodDelay = true;
scope.readablePeriod = readablePeriod;
scope.autoUpdate = false;
@@ -423,6 +425,7 @@ pinpointApp.directive('navbar', [ 'cfg', '$rootScope', '$http',
* @param time
*/
scope.setAutoUpdateTime = function (time) {
$at($at.MAIN, $at.CLK_UPDATE_TIME, time + "s");
scope.timeCountDown = time;
scope.timeLeft = time;
};
@@ -450,6 +453,7 @@ pinpointApp.directive('navbar', [ 'cfg', '$rootScope', '$http',
* @param type
*/
scope.togglePeriod = function (type) {
$at($at.MAIN, $at.TG_DATE, type);
scope.periodType = type;
scope.autoUpdate = false;
};
@@ -459,6 +463,7 @@ pinpointApp.directive('navbar', [ 'cfg', '$rootScope', '$http',
*/
scope.$watch('autoUpdate', function (newVal, oldVal) {
if (newVal) {
$at($at.MAIN, $at.TG_UPDATE_ON);
$timeout(startUpdate, 1000);
} else {
resetTimeLeft();
@@ -233,6 +233,7 @@ pinpointApp
* @param applicationName
*/
scope.renderNodeAgentCharts = function (applicationName) {
$at($at.MAIN, $at.CLK_SHOW_GRAPH);
if (angular.isDefined(htAgentChartRendered[applicationName])) return;
htAgentChartRendered[applicationName] = true;
renderResponseSummary(null, applicationName, htLastNode.agentHistogram[applicationName], '100%', '150px');
@@ -88,7 +88,9 @@ pinpointApp
};
}
oChart = AmCharts.makeChart(id, options);
oChart.addListener('clickGraph', function(e) {
$at($at.MAIN, $at.CLK_RESPONSE_GRAPH);
});
if (useFilterTransaction) {
oChart.addListener('clickGraphItem', clickGraphItemListener);
oChart.addListener('rollOverGraphItem', function (e) {
@@ -544,6 +544,7 @@ pinpointApp.directive('serverMap', [ 'serverMapConfig', 'ServerMapDao', 'Alerts'
* passing transaction list
*/
scope.passingTransactionList = function () {
$at($at.CONTEXT, $at.CLK_FILTER_TRANSACTION);
var oServerMapFilterVo = new ServerMapFilterVo();
oServerMapFilterVo
.setMainApplication(htLastLink.filterApplicationName)
@@ -567,6 +568,7 @@ pinpointApp.directive('serverMap', [ 'serverMapConfig', 'ServerMapDao', 'Alerts'
* open filter wizard
*/
scope.openFilterWizard = function () {
$at($at.CONTEXT, $at.CLK_FILTER_TRANSACTION_WIZARD);
openFilterWizard();
};
@@ -653,6 +655,7 @@ pinpointApp.directive('serverMap', [ 'serverMapConfig', 'ServerMapDao', 'Alerts'
* toggle merge group
*/
scope.toggleMergeGroup = function ( mergeType ) {
$at($at.CONTEXT, $at.TG_MERGE_TYPE, mergeType);
scope.mergeStatus[ mergeType ] = !scope.mergeStatus[ mergeType ];
//scope.mergeUnknowns = (scope.mergeUnknowns) ? false : true;
serverMapCallback(htLastQuery, htLastMapData.applicationMapData, scope.linkRouting, scope.linkCurve);
@@ -664,6 +667,16 @@ pinpointApp.directive('serverMap', [ 'serverMapConfig', 'ServerMapDao', 'Alerts'
* @param type
*/
scope.toggleLinkLableTextType = function (type) {
if ( type === "tps" ) {
$at($at.CONTEXT, $at.TG_TPS);
scope.totalRequestCount = false;
scope.tps = true;
} else {
$at($at.CONTEXT, $at.TG_CALL_COUNT);
scope.totalRequestCount = true;
scope.tps = false;
}
scope.totalRequestCount = (type !== 'tps') ? true : false;
scope.tps = (type === 'tps') ? true : false;
serverMapCallback(htLastQuery, htLastMapData.applicationMapData, scope.linkRouting, scope.linkCurve);
@@ -675,6 +688,7 @@ pinpointApp.directive('serverMap', [ 'serverMapConfig', 'ServerMapDao', 'Alerts'
* @param type
*/
scope.toggleLinkRouting = function (type) {
$at($at.CONTEXT, $at.TG_ROUTING, type);
scope.linkRouting = cfg.options.htLinkType.sRouting = type;
serverMapCallback(htLastQuery, htLastMapData.applicationMapData, scope.linkRouting, scope.linkCurve);
reset();
@@ -685,6 +699,7 @@ pinpointApp.directive('serverMap', [ 'serverMapConfig', 'ServerMapDao', 'Alerts'
* @param type
*/
scope.toggleLinkCurve = function (type) {
$at($at.CONTEXT, $at.TG_CURVE, type);
scope.linkCurve = cfg.options.htLinkType.sCurve = type;
serverMapCallback(htLastQuery, htLastMapData.applicationMapData, scope.linkRouting, scope.linkCurve);
reset();
@@ -694,7 +709,9 @@ pinpointApp.directive('serverMap', [ 'serverMapConfig', 'ServerMapDao', 'Alerts'
* refresh
*/
scope.refresh = function () {
$at($at.CONTEXT, $at.CLK_REFRESH);
if (oServerMap) {
oServerMap.refresh();
}
reset();
@@ -761,11 +778,13 @@ pinpointApp.directive('serverMap', [ 'serverMapConfig', 'ServerMapDao', 'Alerts'
}
scope.searchNode = function() {
if (oServerMap && scope.searchNodeQuery !== "" ) {
$at($at.MAIN, $at.CLK_SEARCH_NODE);
scope.searchNodeIndex = 0;
scope.searchNodeList = oServerMap.searchNode( scope.searchNodeQuery );
}
};
scope.clearSearchNode = function() {
$at($at.MAIN, $at.CLK_CLEAR_SEARCH);
oServerMap.clearQuery();
scope.searchNodeIndex = 0;
scope.searchNodeQuery = "";
@@ -120,6 +120,7 @@ pinpointApp.directive('timeSlider', [ 'timeSliderConfig', '$timeout', function (
* scope more
*/
scope.more = function () {
$at($at.CALLSTACK, $at.CLK_MORE);
scope.$emit('timeSlider.moreClicked', scope.oTimeSliderVo);
};
@@ -29,6 +29,7 @@ pinpointApp.directive('timeline', function () {
initialize(transactionDetail);
});
scope.moveCallFlow = function( item ) {
$at($at.CALLSTACK, $at.CLK_CALL);
scope.$emit( "transactionDetail.selectDistributedCallFlowRow", item[6] );
};
}
@@ -56,6 +56,7 @@ pinpointApp.directive('transactionTable', ['$window', function ($window) {
* @param transaction
*/
scope.traceByApplication = function (transaction) {
$at($at.CALLSTACK, $at.CLK_TRANSACTION);
scope.currentTransaction = transaction;
scope.$emit('transactionTable.applicationSelected', transaction);
};
@@ -87,6 +88,7 @@ pinpointApp.directive('transactionTable', ['$window', function ($window) {
} else {
scope.transactionReverse = false;
}
$at($at.CALLSTACK, $at.ST_ + orderKey.charAt(0).toUpperCase() + orderKey.substring(1), scope.transactionReverse ? $at.DESCENDING : $at.ASCENDING );
scope.transactionOrderBy = orderKey;
};
@@ -0,0 +1,81 @@
(function( global ) {
var $at = function() {};
if ( typeof ga !== "undefined" ) {
$at = function( category, name, label, count, options ) {
if ( arguments.length == 1 ) {
ga( 'send', 'pageview', arguments[0] );
} else {
ga( 'send', 'event', category, name, label, count, options );
}
};
} else if ( typeof wcs !== "undefined" ) {
$at = function( category, name, label ) {
if ( arguments.length == 1 ) return;
if ( typeof label !== "undefined" || typeof label !== "null" ) {
name = name + "_" + label;
}
wcs.event( category, name );
};
}
$at.MAIN = "Main";
$at.CONTEXT = "Context";
$at.CALLSTACK = "CallStack";
$at.MIXEDVIEW = "MixedView";
$at.CLK_APPLICATION = "ClickApplication";
$at.CLK_TIME = "ClickTime";
$at.CLK_SEARCH_NODE = "ClickSearchNode";
$at.CLK_CLEAR_SEARCH = "ClickClearSearch";
$at.CLK_NODE = "ClickNode";
$at.CLK_LINK = "ClickLink";
$at.CLK_UPDATE_TIME = "ClickUpdateTime";
$at.CLK_HELP = "ClickHelp";
$at.CLK_SCATTER_SETTING = "ClickScatterSetting";
$at.CLK_DOWNLOAD_SCATTER = "ClickDownloadScatter";
$at.CLK_RESPONSE_GRAPH = "ClickResponseGraph";
$at.CLK_LOAD_GRAPH = "ClickLoadGraph";
$at.CLK_SHOW_GRAPH = "ClickShowGraph";
$at.CLK_FILTER_TRANSACTION = "ClickFilterTransaction";
$at.CLK_FILTER_TRANSACTION_WIZARD = "ClickFilterTransactionWizard";
$at.CLK_MORE = "ClickMore";
$at.CLK_DISTRIBUTED_CALL_FLOW = "ClickDistributedCallFlow";
$at.CLK_SERVER_MAP = "ClickServerMap";
$at.CLK_RPC_TIMELINE = "ClickRPCTimeline";
$at.CLK_CALL = "ClickCall";
$at.CLK_TRANSACTION = "ClickTransaction";
$at.CLK_HEAP = "ClickHeap";
$at.CLK_PERM_GEN = "ClickPermGen";
$at.CLK_CPU_LOAD = "ClickCpuLoad";
$at.CLK_REFRESH = "ClickRefresh";
$at.TG_DATE = "ToggleDate";
$at.TG_UPDATE_ON = "ToggleUpdateOn";
$at.TG_NODE_VIEW = "ToggleNodeView";
$at.TG_SCATTER_SUCCESS = "ToggleScatterSuccess";
$at.TG_SCATTER_FAILED = "ToggleScatterFailed";
$at.TG_MERGE_TYPE = "ToggleMergeType";
$at.TG_CALL_COUNT = "ToggleCallCount";
$at.TG_TPS = "ToggleTPS";
$at.TG_ROUTING = "ToggleRouting";
$at.TG_CURVE = "ToggleCurve";
$at.ST_ = "Sort";
$at.ASCENDING = "ascending";
$at.DESCENDING = "descending";
$at.ON = "on";
$at.OFF = "off";
$at.MAIN_PAGE = "/main.page";
$at.FILTEREDMAP_PAGE = "/filteredMap.page";
$at.INSPECTOR_PAGE = "/inspector.page";
$at.SCATTER_FULL_SCREEN_PAGE = "/scatterFullScreen.page";
$at.TRANSACTION_DETAIL_PAGE = "/transactionDetail.page";
$at.TRANSACTION_LIST_PAGE = "/transactionList.page";
$at.TRANSACTION_VIEW_PAGE = "/transactionView.page";
global.$at = $at;
})(window);
+1 -1
View File
@@ -93,7 +93,7 @@
<label for="urlPattern" class="col-sm-2 control-label">URL Pattern</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="urlPattern" placeholder="Request URL Pattern" ng-model="urlPattern">
<input type="text" class="form-control" id="urlPattern" placeholder="Request URL Pattern ( /pinpoint/**/??.html )" ng-model="urlPattern">
</div>
<div class="col-sm-2" style="padding-top:7px">
<span class="label label-info">ant-style</span>