gpt4 book ai didi

azure - 应用程序洞察 : How to disable SQL Dependency telemetry

转载 作者:行者123 更新时间:2023-12-03 03:31:40 26 4
gpt4 key购买 nike

我们将 Azure Application Insights 用于网站(Azure 应用服务),并且 SQL 依赖项日志正在填满日志。 Transaction logs

我们已在 ApplicationInsights.config 中注释了以下行
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/>

我们可以在哪里禁用这些?

最佳答案

我在 SO 中发现了类似的问题,涉及禁用 SQL 依赖项遥测(Application Insights),其中 James Davis 提供了解决方案](App Insights: Disable SQL Dependency telemetry)“https://stackoverflow.com/q/38320886/16630138) ") 这可能有助于满足您的要求

using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.DataContracts;

public class SuccessfulDependencyFilter : ITelemetryProcessor
{
private ITelemetryProcessor Next { get; set; }

// next will point to the next TelemetryProcessor in the chain.
public SuccessfulDependencyFilter(ITelemetryProcessor next)
{
this.Next = next;
}

public void Process(ITelemetry item)
{
// To filter out an item, return without calling the next processor.
if (!OKtoSend(item)) { return; }

this.Next.Process(item);
}

// Example: replace with your own criteria.
private bool OKtoSend (ITelemetry item)
{
var dependency = item as DependencyTelemetry;
if (dependency == null) return true;

return dependency.Success != true;
}
}

引用link

关于azure - 应用程序洞察 : How to disable SQL Dependency telemetry,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74602263/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com