在 Azure Application Insights 中禁用地理定位

Disable Geolocation in 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 中看到比我想要的更多的细节,而且它详细到城市。我没有足够的用户来匿名化,所以可能每个城市都是一个独特的用户(甚至可能是整个国家),并且用户之间不会有足够多的重复,所以这是不可逆转的。

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

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

您可以通过明确设置 city/state/country 来实现。如果在传入事件中设置了其中任何一个,则不会完成基于 IP 地址的 GeoIP 查找。

查看 bond specification,相关部分在这里:

[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" 或其他内容以不生成所有其他字段。