【问题标题】:Does Azure Application Insights provide any built-ways to anonymize user data?Azure Application Insights 是否提供任何内置方法来匿名化用户数据?
【发布时间】:2019-12-23 16:59:45
【问题描述】:

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

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

【问题讨论】:

  • 匿名用户数据是什么意思?不发送这些用户相关数据?
  • 是的,“不要发送/存储这些用户相关数据”,这将是一个很好的总结,但不知道 azure 平台方面的选项是什么,我将这个问题尽可能地模糊.
  • 至少,云中现有数据不能更改。但不确定我们是否可以在客户端上执行此操作,因为数据正在发送到应用洞察。

标签: .net azure azure-application-insights


【解决方案1】:

您可以为 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://docs.microsoft.com/en-us/azure/azure-monitor/app/api-filtering-sampling

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-16
    • 2019-04-05
    • 2017-03-03
    • 1970-01-01
    • 2022-01-11
    • 2021-07-16
    • 2016-01-05
    • 1970-01-01
    相关资源
    最近更新 更多