ServiceStack MiniProfiler Ajax Requests Logging

So, on my Index.cshtml page, when I initially load the page, I:

 @inherits ViewPage <!DOCTYPE html> <html> <head> <script type="text/javascript" src="ext-all-debug.js"></script> <script type="text/javascript" src="app.js"></script> <script type="text/javascript" src="app.ext.js"></script> <script type="text/javascript" src="dump.js"></script> @ServiceStack.MiniProfiler.Profiler.RenderIncludes().AsRaw() </head> <body> </body> </html> 

enter image description here

Ok, I can see the profiling index, a bunch of ExtJS and the first ajax call for my ServerStack ServiceStack (in / api / session).

Now in my ExtJS form, I have a Customers tab, when I click it, it sends an ajax request to /api/customers , and I have a tab, when I click on it, it calls /api/orders .

But then, when I start clicking, tell the Customers tab, does Miniprofiler no longer add any subsequent ajax requests to the list? I thought that Miniprofiler can log ajax requests, nothing special needs to be done? Why doesn't it log subsequent ajax requests for me? Am I missing something?

+4
source share
2 answers

The current version, available through Nuget, does not support ajax ExtJS call interception. There seems to be a transfer request for this function, but it is not yet available.

Here is what I needed to do to get around this:

 Ext.require('Ext.Ajax'); Ext.onReady(function () { Ext.Ajax.on('requestcomplete', function (e, xhr, settings) { if (typeof (MiniProfiler) != 'undefined') { var stringIds = xhr.getResponseHeader('X-MiniProfiler-Ids'); if (stringIds) { var ids = typeof JSON != 'undefined' ? JSON.parse(stringIds) : eval(stringIds); MiniProfiler.fetchResultsExposed(ids); } } }); }); 
+5
source

I know this is a little old, but if anyone is interested, the implementation for using miniprofiler with angularjs is as follows:

 app.config(['$httpProvider', function ($httpProvider) { $httpProvider.interceptors.push(["$q", function ($q) { return { 'response': function (response) { if (typeof (MiniProfiler) != 'undefined' && response.config.url.indexOf(".html") < 0) { var stringIds = response.headers('X-MiniProfiler-Ids'); if (stringIds) { MiniProfiler.fetchResultsExposed(angular.fromJson(stringIds)); } } return response || $q.when(response); } }; }]); }]); 
+6
source

All Articles