Mat*_*Mat 0 c# wpf asp.net-mvc azure-application-insights
我们只是从Application Insights开始。尽管它主要是针对在云中运行的应用程序构建的,但我们也使用它来跟踪WPF客户端的一些使用情况统计信息。
对于此安装,我们不想跟踪cloud_RoleInstance中的计算机名称。这是我们的隐私政策问题。与小型公司一样,存储计算机名称甚至变得更加关键,计算机名称可能是用户名。至少在我们的市场上,这是不可行的。
这就是为服务器和WPF客户端设置遥测客户端的方式。
TelemetryClient telemetryClient = new TelemetryClient() { InstrumentationKey = ApplicationInsightsHelper.InstrumentationKey };
//do not track username...
//telemetryClient.Context.User.Id = Environment.UserName;
telemetryClient.Context.Session.Id = SessionId.ToString();
telemetryClient.Context.Device.OperatingSystem = GetWindowsFriendlyName();
telemetryClient.Context.Component.Version = Version;
telemetryClient.Context.Properties.Add("ComponentName", ComponentName);
telemetryClient.Context.Properties.Add("CustomerId", CustomerId);
Run Code Online (Sandbox Code Playgroud)
现在,我的问题是如何设置遥测客户端以删除,混淆,覆盖cloud_RoleInstance属性。
提前致谢
好的,这比我想象的要容易:
telemetryClient.Context.Cloud.RoleInstance = CustomerId;
Run Code Online (Sandbox Code Playgroud)
希望这对某人有帮助...