gpt4 book ai didi

.net - Azure Application Insights 是否提供任何内置方法来匿名化用户数据?

转载 作者:行者123 更新时间:2023-12-03 04:06:42 24 4
gpt4 key购买 nike

这个问题User information with Application Insights演示如何检索用户相关信息。

Azure Application Insights 是否提供任何内置方法来匿名化用户数据,无论是在事后(在“云中”的现有数据上运行某些进程),还是在数据获取时在客户端 API 端 (.NET) 上进行匿名化发送给它?

最佳答案

您可以为 Application Insights SDK 编写和配置插件,以自定义在将遥测数据发送到 Application Insights 服务之前如何丰富和处理遥测数据。

通过遥测处理器进行过滤,您可以在将 SDK 中的遥测数据发送到服务器之前将其过滤掉。例如,您可以通过排除来自机器人的请求来减少遥测量。过滤是比采样更基本的减少流量的方法。它允许您更好地控制传输的内容,但您必须意识到它会影响您的统计数据 - 例如,如果您过滤掉所有成功的请求。

您可以编写过滤逻辑并在将数据发送到服务器之前对数据进行匿名化。

以下是依赖过滤器的示例:

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

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;
}
}

您可以在下面的文档中阅读有关过滤和采样的更多信息,看看是否有帮助。

https://learn.microsoft.com/en-us/azure/azure-monitor/app/api-filtering-sampling

关于.net - Azure Application Insights 是否提供任何内置方法来匿名化用户数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59458881/

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