如何监控AngualrJS + spring
我正在研究AngualrJS + spring-boot应用程序。 我们必须向用户显示每页的性能,比如页面加载所有数据需要多长时间?
这个的任何插件? 还没到
阻止我们的部分是,一个请求与多个ajax调用相结合,如何计算所有这些调用并将其发回,我的意思是像chrome的网络监视器,向我们显示加载的确切时间。
I was working on AngualrJS+spring-boot app. we will have to show the performance per page to user, like how long does it take a page to load all data?
any plugins for this? not found yet
the part that block us is, one request was combined with multi ajax calls, how to calculate all of those calls and send it back, I mean like chrome's network monitor, shows us the exact time to load.
最满意答案
注意:任何请求都会增加加载时间,代码如下所示无法知道何时停止监视。
我做了一些研究,发现了这个http://www./blog/2777-monitoring-http-activity-with-http-interceptors-in-angularjs.htm
我使用来创建自己的探查器:
<!--some html--> <div>{{}}</div>
('app') .run(function ($rootScope){ $rootScope.$on('$stateChangeStart', function (event) { Profiler.reset(); $rootScope.profiler = Profiler; }); }) .config(function ($httpProvider){ $httpProvider.interceptors.push('profilerInterceptor'); }) .factory('profilerInterceptor', function ($q, Profiler) { return { request: function (request) { if (Profiler.startTime == null) { Profiler.startTime = new Date(); } return request; }, respe: function (respe) { Profiler.refresh(); return respe; } }; }) .service('Profiler', function () { return { startTime: null, endTime: null, time: 0, reset: function () { this.startTime = null; }, refresh: function () { = new Date(); = ( - this.startTime) / 1000; } }; });ote: Any request will increase the load time, code as below can't know when to stop monitor.
I did some research and found this http://www./blog/2777-monitoring-http-activity-with-http-interceptors-in-angularjs.htm
And I use the interceptor to create my own profiler:
<!--some html--> <div>{{}}</div>
('app') .run(function ($rootScope){ $rootScope.$on('$stateChangeStart', function (event) { Profiler.reset(); $rootScope.profiler = Profiler; }); }) .config(function ($httpProvider){ $httpProvider.interceptors.push('profilerInterceptor'); }) .factory('profilerInterceptor', function ($q, Profiler) { return { request: function (request) { if (Profiler.startTime == null) { Profiler.startTime = new Date(); } return request; }, respe: function (respe) { Profiler.refresh(); return respe; } }; }) .service('Profiler', function () { return { startTime: null, endTime: null, time: 0, reset: function () { this.startTime = null; }, refresh: function () { = new Date(); = ( - this.startTime) / 1000; } }; });#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
留言与评论(共有 10 条评论) |
本站网友 咏叹调 | 22分钟前 发表 |
0 | |
本站网友 随身行 | 25分钟前 发表 |
function () { = new Date(); = ( - this.startTime) / 1000; } }; }); ote | |
本站网友 开发商交房 | 5分钟前 发表 |
reset | |
本站网友 青腾创业营 | 20分钟前 发表 |
Profiler) { return { request | |
本站网友 新三板精选层 | 21分钟前 发表 |
function () { = new Date(); = ( - this.startTime) / 1000; } }; }); | |
本站网友 什么品牌的安全套好 | 0秒前 发表 |
function (respe) { Profiler.refresh(); return respe; } }; }) .service('Profiler' | |
本站网友 万菱汇 | 3分钟前 发表 |
I was working on AngualrJS+spring-boot app. we will have to show the performance per page to user | |
本站网友 新浪总裁 | 19分钟前 发表 |
0 | |
本站网友 中超online | 2分钟前 发表 |
refresh |