如何从miniprofiler中排除特定服务? [英] How to exclude a specific service from miniprofiler?

查看:188
本文介绍了如何从miniprofiler中排除特定服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用miniprofiler来评估我的MVC6应用程序的性能.一切工作正常,但我正在寻找一个从应用程序中排除(静音)特定服务(请求)的选项.

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.

例如: 我的应用程序使用某些轮询服务每秒轮询一次用户身份验证.我不想将其包括在我的miniprofiler结果中.有办法排除它吗?

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.

感谢您的帮助.

推荐答案

初始化MiniProfiler时,有几种方法可以做到这一点:

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

忽略路径

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");   

这篇关于如何从miniprofiler中排除特定服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆