首页 > 解决方案 > 在 Azure Application Insights 中禁用地理位置

问题描述

我正在创建一个开源项目,我在其中使用 Application Insights 将指标添加到桌面应用程序。我想把隐私放在数据收集的最前沿,所以我尽量不收集任何超过绝对必要的数据,一般来说,根本没有个人身份信息。我似乎已经成功擦除了发送到服务器的数据,这里是一个示例数据上传:

{"ver":1,"name":"Microsoft.ApplicationInsights.guid.Event","time":"2020-04-25T03:31:15.464+0200","sampleRate":100.0,"iKey":"guid","tags":{"ai.internal.nodeName":"aeb804e4-c649-4a9c-bd57-905c7e81abf3","ai.session.id":"aeb804e4-c649-4a9c-bd57-905c7e81abf3","ai.session.isNew":"true"},"data":{"baseType":"EventData","baseData":{"ver":2,"name":"application.startupMode","properties":{"mode":"help"}}}

除了我擦洗的检测密钥之外,这是我发送的完整数据,如您所见,与用户完全无关。会话 ID 会重置程序的每次运行。但是,无论如何,地理位置似乎都在发生,我可以在 Application Insights 中看到比我想要的更多的详细信息,并且详细到城市。我没有足够的用户来匿名,所以可能每个城市都是唯一的用户(甚至可能是整个国家),并且用户之间没有足够的重复,这是不可逆转的。

来自门户的图像

我已经从这张图片中清除了地理位置数据。

因此,我想阻止这些数据被记录,或者至少我无法访问。这可能吗?我什至可以伪造数据,但我不希望不必设置代理服务器或类似的复杂东西。

标签: azureazure-application-insightsprivacy

解决方案


可以通过自己明确设置城市/州/国家。如果在传入事件中设置了其中任何一个,则不会完成基于 IP 地址的 GeoIP 查找。

请参阅债券规范,相关部分在这里:

[Description("The IP address of the client device. IPv4 and IPv6 are supported. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.")]
[MaxStringLength("46")]
200: string      LocationIp = "ai.location.ip";

[Description("The country of the client device. If any of Country, Province, or City is specified, those values will be preferred over geolocation of the IP address field. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.")]
[MaxStringLength("256")]
201: string      LocationCountry = "ai.location.country";

[Description("The province/state of the client device. If any of Country, Province, or City is specified, those values will be preferred over geolocation of the IP address field. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.")]
[MaxStringLength("256")]
202: string      LocationProvince = "ai.location.province";

[Description("The city of the client device. If any of Country, Province, or City is specified, those values will be preferred over geolocation of the IP address field. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.")]
[MaxStringLength("256")]
203: string      LocationCity = "ai.location.city";

我不是 100% 确定如何在 Java sdk 中设置它们,但我知道后端支持它(因为我是很久以前添加它的人)

假设您可以设置context.country为字符串"Unknown"或其他内容以使所有其余字段不被生成。


推荐阅读