2017-03-17 69 views
0

我們剛剛開始使用Application Insights。儘管主要針對在雲中運行的應用程序構建,但我們也使用它來跟蹤WPF客戶端的一些使用統計信息。如何使用Application Insights覆蓋或忽略cloud_RoleInstance

對於此安裝,我們不想跟蹤機器名稱,因爲它在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); 

現在我的問題是如何設置遙測客戶端來刪除,混淆,覆蓋cloud_RoleInstance屬性。

在此先感謝

回答

4

好吧,這是更容易比我想象:

telemetryClient.Context.Cloud.RoleInstance = CustomerId; 

希望這有助於有人...