Beispiel #1
0
 public override void AddSharedProperties(List <KeyValuePair <string, object> > sharedProperties, TelemetryContext telemetryContext)
 {
     sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.ExeName", hostInfoProvider.ProcessName));
     if (hostVersionInfo.Value != null)
     {
         FileVersionInfo value = hostVersionInfo.Value;
         sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.ExeVersion", string.Format(CultureInfo.InvariantCulture, "{0}.{1}.{2}.{3}", value.FileMajorPart, value.FileMinorPart, value.FileBuildPart, value.FilePrivatePart)));
         sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.BuildNumber", value.FileBuildPart));
     }
     sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.ProcessId", hostInfoProvider.ProcessId));
 }
Beispiel #2
0
 public void AddSharedProperties(List <KeyValuePair <string, object> > sharedProperties, TelemetryContext telemetryContext)
 {
     sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.MacAddressHash", macInformationProvider.GetMACAddressHash()));
     sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.Machine.Id", machineInformationProvider.MachineId));
     macInformationProvider.RunProcessIfNecessary(delegate(string macAddress)
     {
         telemetryContext.SharedProperties["VS.Core.MacAddressHash"] = macAddress;
     });
 }
Beispiel #3
0
        /// <summary>
        /// Validate coming event
        /// </summary>
        /// <param name="eventProcessorContext"></param>
        /// <returns></returns>
        public bool Execute(IEventProcessorContext eventProcessorContext)
        {
            TelemetryEvent telemetryEvent = eventProcessorContext.TelemetryEvent;

            if (TelemetryContext.IsEventNameContextPostProperty(telemetryEvent.Name))
            {
                return(telemetryEvent.Properties.Any((KeyValuePair <string, object> p) => !TelemetryEvent.IsPropertyNameReserved(p.Key) && !TelemetryContext.IsPropertyNameReserved(p.Key)));
            }
            return(true);
        }
Beispiel #4
0
 public void AddSharedProperties(List <KeyValuePair <string, object> > sharedProperties, TelemetryContext telemetryContext)
 {
 }
Beispiel #5
0
        public void AddSharedProperties(List <KeyValuePair <string, object> > sharedProperties, TelemetryContext telemetryContext)
        {
            IEnumerable <KeyValuePair <string, object> > allProperties = persistedSessionProperties.GetAllProperties();

            sharedProperties.AddRange(allProperties);
        }
Beispiel #6
0
 public void PostProperties(TelemetryContext telemetryContext, CancellationToken token)
 {
 }
Beispiel #7
0
 /// <summary>
 /// Execute action on event, using telemetryManifestContext as a provider of the necessary information.
 /// Return true if it is allowed to execute next actions.
 /// Return false action forbids the event.
 /// By default OptOut set IsEventDropped to the true, and exclude all properties.
 /// </summary>
 /// <param name="eventProcessorContext"></param>
 /// <returns>Indicator, whether current action is not explicitely forbid current event</returns>
 public bool Execute(IEventProcessorContext eventProcessorContext)
 {
     if (!eventProcessorContext.HostTelemetrySession.IsOptedIn)
     {
         TelemetryEvent telemetryEvent = eventProcessorContext.TelemetryEvent;
         if (!telemetryEvent.IsOptOutFriendly && !optoutFriendlyEvents.Contains(telemetryEvent.Name))
         {
             eventProcessorContext.IsEventDropped = true;
         }
         foreach (string item in new List <string>(telemetryEvent.Properties.Keys))
         {
             if ((!telemetryEvent.IsOptOutFriendly || TelemetryEvent.IsPropertyNameReserved(item) || TelemetryContext.IsPropertyNameReserved(item)) && !optoutFriendlyProperties.Contains(item))
             {
                 eventProcessorContext.ExcludePropertyFromEvent(item);
             }
         }
     }
     return(true);
 }
Beispiel #8
0
 public void AddSharedProperties(List <KeyValuePair <string, object> > sharedProperties, TelemetryContext telemetryContext)
 {
     sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.User.Id", userInfoProvider.UserId));
     sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.User.IsMicrosoftInternal", userInfoProvider.IsUserMicrosoftInternal));
     sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.User.Location.GeoId", RegionInfo.CurrentRegion.GeoId));
     sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.User.Type", userInfoProvider.UserType.ToString()));
 }
Beispiel #9
0
 public void PostProperties(TelemetryContext telemetryContext, CancellationToken token)
 {
     if (token.IsCancellationRequested)
     {
         return;
     }
     if (operatingSystemVersionInfo.Value != null)
     {
         telemetryContext.PostProperty("VS.Core.OS.BuildLab", operatingSystemVersionInfo.Value.KernelOSVersion);
         if (token.IsCancellationRequested)
         {
             return;
         }
     }
     telemetryContext.PostProperty("VS.Core.OS.ClrVersion", environmentTools.Version);
     if (token.IsCancellationRequested)
     {
         return;
     }
     if (productNameInfo.Value != null)
     {
         telemetryContext.PostProperty("VS.Core.OS.ProductName", productNameInfo.Value);
         if (token.IsCancellationRequested)
         {
             return;
         }
     }
     telemetryContext.PostProperty("VS.Core.OS.Display.Count", displayInfo.Value.DisplayCount);
     if (token.IsCancellationRequested)
     {
         return;
     }
     telemetryContext.PostProperty("VS.Core.OS.Display.Resolution", displayInfo.Value.MainDisplayWidth * displayInfo.Value.MainDisplayHeight);
     if (token.IsCancellationRequested)
     {
         return;
     }
     telemetryContext.PostProperty("VS.Core.OS.Display.XY", string.Format(CultureInfo.InvariantCulture, "{0}x{1}", new object[2]
     {
         displayInfo.Value.MainDisplayWidth,
         displayInfo.Value.MainDisplayHeight
     }));
     if (token.IsCancellationRequested)
     {
         return;
     }
     telemetryContext.PostProperty("VS.Core.OS.Display.VirtualXY", string.Format(CultureInfo.InvariantCulture, "{0}x{1}", new object[2]
     {
         displayInfo.Value.MainDisplayWidth,
         displayInfo.Value.MainDisplayHeight
     }));
     if (token.IsCancellationRequested)
     {
         return;
     }
     if (totalVolumesSize.Value.HasValue)
     {
         telemetryContext.PostProperty("VS.Core.OS.Drive.AllVolumesSize", totalVolumesSize.Value);
         if (token.IsCancellationRequested)
         {
             return;
         }
     }
     if (rootDriveInfo.Value == null)
     {
         return;
     }
     telemetryContext.PostProperty("VS.Core.OS.Drive.VolumeSize", rootDriveInfo.Value.VolumeSize);
     if (!token.IsCancellationRequested)
     {
         telemetryContext.PostProperty("VS.Core.OS.Drive.FreeVolumeSpace", rootDriveInfo.Value.FreeVolumeSpace);
         if (!token.IsCancellationRequested)
         {
             telemetryContext.PostProperty("VS.Core.OS.Drive.FileSystem", rootDriveInfo.Value.FileSystem);
         }
     }
 }
Beispiel #10
0
 public void AddSharedProperties(List <KeyValuePair <string, object> > sharedProperties, TelemetryContext telemetryContext)
 {
     sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.OS.Version", operatingSystemVersionInfo.Value.Version));
 }
Beispiel #11
0
 public void AddRealtimeSharedProperties(List <KeyValuePair <string, Func <object> > > sharedProperties, TelemetryContext telemetryContext)
 {
     sharedProperties.Add(new KeyValuePair <string, Func <object> >("VS.Core.IsDebuggerAttached", () => hostInformationProvider.IsDebuggerAttached ? ((object)true) : null));
 }