azure – App Insights:禁用SQL依赖关系遥测
发布时间:2020-05-28 14:22:13 所属栏目:MsSql 来源:互联网
导读:我正在将Azure Application Insights用于网站(Azure App Service). 在那我正在使用集群Umbraco设置和hangfire.这两个人每分钟都在不断地访问数据库,并且充斥着我的“App Insights”. 所以我的问题是,如何禁用Sql Dependency Tracker? 我看过ApplicationInsig
|
我正在将Azure Application Insights用于网站(Azure App Service).
所以我的问题是,如何禁用Sql Dependency Tracker? 谢谢 解决方法这里最好的选择是使用遥测处理器来过滤掉某些类型的依赖请求.请查看以下这些资源以获取信息.Sampling,filtering and preprocessing telemetry in the Application Insights SDK Request filtering in Application Insights with Telemetry Processor 示例处理器可能如下所示. using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.DataContracts;
public class NoSQLDependencies : ITelemetryProcessor
{
private ITelemetryProcessor Next { get; set; }
// Link processors to each other in a chain.
public NoSQLDependencies(ITelemetryProcessor next)
{
this.Next = next;
}
public void Process(ITelemetry item)
{
if (IsSQLDependency(item)) { return; }
this.Next.Process(item);
}
private bool IsSQLDependency(ITelemetry item)
{
var dependency = item as DependencyTelemetry;
if (dependency?.DependencyTypeName == "SQL")
{
return true;
}
return false;
}
} (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
