簡體   English   中英

如何使用Application Insights覆蓋或忽略cloud_RoleInstance

[英]How to overwrite or ignore cloud_RoleInstance with 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);

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

提前致謝

好的,這比我想象的要容易:

telemetryClient.Context.Cloud.RoleInstance = CustomerId;

希望這對某人有幫助...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM