How to exclude a specific service from miniprofiler?

蹲街弑〆低调 提交于 2019-12-11 05:29:55

问题


I am using miniprofiler to assess performance of my MVC6 application. Everything is working fine but I am looking for an option to exclude (mute) a particular service (requests) from my application.

For example: My application is polling user authentication every second using some polling service. I don't want to include that in my miniprofiler results. Is there a way to exclude it?

Why I want this? I want to exclude this redundant service, so that I can focus on other results which needs more attention. Also, this polling service is filling fast my results-index page.

Thanks for help.


回答1:


There are several ways to do this, when you are initializing MiniProfiler:

Ignore the path

var ignored = MiniProfiler.Settings.IgnoredPaths.ToList();
ignored.Add("/__browserLink/");
ignored.Add("/path/to/ignore");
MiniProfiler.Settings.IgnoredPaths = ignored.ToArray();

Exclude the Type, Assembly or Method

MiniProfiler.Settings.ExcludeType("SessionFactory"); 
MiniProfiler.Settings.ExcludeAssembly("NHibernate"); 
MiniProfiler.Settings.ExcludeMethod("Flush");   


来源:https://stackoverflow.com/questions/39764563/how-to-exclude-a-specific-service-from-miniprofiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!