/// <summary> /// Instantiate builder itself with all necessary parameters. It is done from the /// TelemetrySessionInitializer object, thus TelemetrySession doesn't care what external /// dependencies are needed for creating EventProcessorChannel and EventProcessor objects. /// </summary> /// <param name="persistentPropertyBag"></param> /// <param name="telemetryScheduler"></param> public EventProcessorChannelBuilder(IPersistentPropertyBag persistentPropertyBag, ITelemetryScheduler telemetryScheduler) { CodeContract.RequiresArgumentNotNull <IPersistentPropertyBag>(persistentPropertyBag, "persistentPropertyBag"); CodeContract.RequiresArgumentNotNull <ITelemetryScheduler>(telemetryScheduler, "telemetryScheduler"); this.persistentPropertyBag = persistentPropertyBag; this.telemetryScheduler = telemetryScheduler; }
public MacMACInformationProvider(IPersistentPropertyBag persistentStorage, ILegacyApi legacyApi) { CodeContract.RequiresArgumentNotNull <IPersistentPropertyBag>(persistentStorage, "persistentStorage"); CodeContract.RequiresArgumentNotNull <ILegacyApi>(legacyApi, "legacyApi"); this.persistentStorage = persistentStorage; this.legacyApi = legacyApi; persistedMAC = new Lazy <string>(() => CalculateMACAddressHash(), LazyThreadSafetyMode.ExecutionAndPublication); }
protected MACInformationProvider(IProcessTools processTools, IPersistentPropertyBag persistentStorage, string command, string commandArgs) { CodeContract.RequiresArgumentNotNull <IProcessTools>(processTools, "processTools"); CodeContract.RequiresArgumentNotNull <IPersistentPropertyBag>(persistentStorage, "persistentStorage"); this.processTools = processTools; this.persistentStorage = persistentStorage; this.command = command; this.commandArgs = commandArgs; persistedMAC = new Lazy <string>(() => CalculateMACAddressHash(), LazyThreadSafetyMode.ExecutionAndPublication); }
/// <summary> /// Set up telemetry session properties /// </summary> /// <param name="settings"></param> /// <param name="initializerObject"></param> /// <param name="isCloned"></param> private TelemetrySession(TelemetrySessionSettings settings, bool isCloned, TelemetrySessionInitializer initializerObject) { CodeContract.RequiresArgumentNotNull <TelemetrySessionInitializer>(initializerObject, "initializerObject"); initializerObject.Validate(); initializerObject.AppInsightsInstrumentationKey = settings.AppInsightsInstrumentationKey; initializerObject.AsimovInstrumentationKey = settings.AsimovInstrumentationKey; TelemetryService.EnsureEtwProviderInitialized(); sessionInitializer = initializerObject; sessionSettings = settings; isSessionCloned = isCloned; cancellationTokenSource = initializerObject.CancellationTokenSource; diagnosticTelemetry = initializerObject.DiagnosticTelemetry; identityTelemetry = initializerObject.IdentityTelemetry; optinStatusReader = initializerObject.OptinStatusReader; channelValidators = initializerObject.ChannelValidators; telemetryBufferChannel = new TelemetryBufferChannel(); initializerObject.WatsonSessionChannelBuilder.Build(this); WatsonSessionChannel sessionChannel = initializerObject.WatsonSessionChannelBuilder.WatsonSessionChannel; if (IsValidChannel(sessionChannel)) { watsonSessionChannel = sessionChannel; } machineInformationProvider = initializerObject.MachineInformationProvider; macInformationProvider = initializerObject.MACInformationProvider; userInformationProvider = initializerObject.UserInformationProvider; defaultContextPropertyManager = initializerObject.DefaultContextPropertyManager; persistentPropertyBag = initializerObject.PersistentPropertyBag; initializerObject.EventProcessorChannelBuilder.Build(this); persistentSharedProperties = initializerObject.PersistentSharedProperties; EventProcessor = initializerObject.EventProcessorChannelBuilder.EventProcessor; if (initializerObject.CustomActionToAdd != null) { foreach (IEventProcessorAction item in initializerObject.CustomActionToAdd) { EventProcessor.AddCustomAction(item); } } eventProcessorChannel = initializerObject.EventProcessorChannelBuilder.EventProcessorChannel; telemetryManifestManager = new Lazy <ITelemetryManifestManager>(() => initializerObject.TelemetryManifestManagerBuilder.Build(this)); contextScheduler = initializerObject.ContextScheduler; if (initializerObject.ChannelsToAdd != null) { AddSessionChannels(initializerObject.ChannelsToAdd); } defaultContext = CreateDefaultContext(); macInformationProvider.MACAddressHashCalculationCompleted += MACAddressHashCalculationCompleted; identityTelemetry.IdentityInformationProvider.HardwareIdCalculationCompleted += HardwareIdCalculationCompleted; }
public EventProcessorRouter(IPersistentPropertyBag persistentPropertyBag) { CodeContract.RequiresArgumentNotNull <IPersistentPropertyBag>(persistentPropertyBag, "persistentPropertyBag"); this.persistentPropertyBag = persistentPropertyBag; }
public MonoMACInformationProvider(IProcessTools processTools, IPersistentPropertyBag persistentStorage) : base(processTools, persistentStorage, "ifconfig", "-a") { }
public WindowsMACInformationProvider(IProcessTools processTools, IPersistentPropertyBag persistentStorage) : base(processTools, persistentStorage, "getmac", null) { }
public PersistentSharedPropertyProvider(IPersistentPropertyBag persistentPropertyBag) { CodeContract.RequiresArgumentNotNull <IPersistentPropertyBag>(persistentPropertyBag, "persistentPropertyBag"); persistedSessionProperties = persistentPropertyBag; }
private static IEnumerable <IPropertyProvider> GetPropertyProviders(IRegistryTools registryTools, IEnvironmentTools environmentTools, IHostInformationProvider host, IMachineInformationProvider machine, IMACInformationProvider macAddress, IUserInformationProvider user, IPersistentPropertyBag sharedProperties, IIdentityInformationProvider identity) { yield return(new IdentityPropertyProvider()); if (Platform.IsMac) { yield return(new MacHostPropertyProvider(host, new NsBundleInformationProvider())); yield return(new AssemblyPropertyProvider()); yield return(new MacLocalePropertyProvider()); yield return(new MacMachinePropertyProvider(machine, registryTools, macAddress)); yield return(new MacOSPropertyProvider(environmentTools)); yield return(new MacUserPropertyProvider(user)); yield return(new PersistentSharedPropertyProvider(sharedProperties)); } else if (Platform.IsLinux) { yield return(new LinuxHostPropertyProvider(host)); yield return(new AssemblyPropertyProvider()); yield return(new LinuxLocalePropertyProvider()); yield return(new PersistentSharedPropertyProvider(sharedProperties)); } else { yield return(new WindowsHostPropertyProvider(host)); yield return(new AssemblyPropertyProvider()); yield return(new WindowsLocalePropertyProvider(registryTools)); yield return(new WindowsMachinePropertyProvider(machine, registryTools, macAddress)); yield return(new WindowsOSPropertyProvider(environmentTools, registryTools)); yield return(new WindowsUserPropertyProvider(user)); yield return(new PersistentSharedPropertyProvider(sharedProperties)); } }
private static IMACInformationProvider GetMACInformationProvider(IProcessTools processTools, IPersistentPropertyBag persistentStorage, ILegacyApi legacyApi) { if (Platform.IsWindows) { return(new WindowsMACInformationProvider(processTools, persistentStorage)); } if (Platform.IsMac) { return(new MacMACInformationProvider(persistentStorage, legacyApi)); } return(new MonoMACInformationProvider(processTools, persistentStorage)); }
private static TelemetrySessionInitializer BuildInitializer(TelemetrySessionSettings telemetrySessionSettings) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); DiagnosticTelemetry diagnosticTelemetry = new DiagnosticTelemetry(); EnvironmentTools environmentTools = new EnvironmentTools(); RegistryTools registryTools = (RegistryTools)(object)new RegistryTools(); ProcessTools processTools = new ProcessTools(); ILegacyApi legacyApi = GetLegacyApi((IRegistryTools)(object)registryTools); IPersistentPropertyBag persistentStorage = CreatePersistentPropertyBag(string.Empty); IPersistentPropertyBag persistentPropertyBag = CreatePersistentPropertyBag("c57a9efce9b74de382d905a89852db71"); IMACInformationProvider mACInformationProvider = GetMACInformationProvider(processTools, persistentStorage, legacyApi); IInternalSettings internalSettings = GetInternalSettings(diagnosticTelemetry, (IRegistryTools)(object)registryTools); IHostInformationProvider hostInformationProvider = GetHostInformationProvider(); IUserInformationProvider userInformationProvider = GetUserInformationProvider((IRegistryTools)(object)registryTools, internalSettings, environmentTools, legacyApi, telemetrySessionSettings); MachineInformationProvider machineInformationProvider = new MachineInformationProvider(legacyApi, userInformationProvider, mACInformationProvider); IIdentityInformationProvider identityInformationProvider = GetIdentityInformationProvider(); IPersistentPropertyBag persistentPropertyBag2 = CreatePersistentPropertyBag(hostInformationProvider.ProcessName); TelemetryScheduler telemetryScheduler = new TelemetryScheduler(); OptOutAction optOutAction = new OptOutAction(); optOutAction.AddOptOutFriendlyEventName("vs/telemetryapi/session/initialized"); optOutAction.AddOptOutFriendlyEventName("context/postproperty"); optOutAction.AddOptOutFriendlyPropertiesList(new List <string> { "Context.Default.VS.Core.BranchName", "Context.Default.VS.Core.BuildNumber", "Context.Default.VS.Core.ExeName", "Context.Default.VS.Core.ExeVersion", "Context.Default.VS.Core.HardwareId", "Context.Default.VS.Core.MacAddressHash", "Context.Default.VS.Core.Machine.Id", "Context.Default.VS.Core.SkuName", "Context.Default.VS.Core.OS.Version", "Context.Default.VS.Core.ProcessId", "Context.Default.VS.Core.User.Id", "Context.Default.VS.Core.User.IsMicrosoftInternal", "Context.Default.VS.Core.User.IsOptedIn", "Context.Default.VS.Core.User.Location.GeoId", "Context.Default.VS.Core.User.Type", "Context.Default.VS.Core.Version", "Reserved.EventId", "Reserved.SessionId", "Reserved.TimeSinceSessionStart", "VS.Core.Locale.Product", "VS.Core.Locale.System", "VS.Core.Locale.User", "VS.Core.Locale.UserUI", "VS.Core.SkuId", "VS.Sqm.SkuId" }); ClientSideThrottlingAction item = new ClientSideThrottlingAction(new List <string> { "context/create", "context/close", "context/postproperty", "vs/core/command", "vs/core/extension/installed", "vs/core/sessionstart", "vs/core/sessionend", "vs/telemetryapi/session/initialized", "vs/telemetryapi/clientsidethrottling", "vs/telemetryapi/manifest/load", "vs/telemetryapi/piiproperties" }, 0.0, 0L); PIIPropertyProcessor pIIPropertyProcessor = new PIIPropertyProcessor(); PiiAction item2 = new PiiAction(pIIPropertyProcessor); ComplexPropertyAction item3 = new ComplexPropertyAction(new JsonComplexObjectSerializerFactory(), pIIPropertyProcessor); return(new TelemetrySessionInitializer { CancellationTokenSource = cancellationTokenSource, SessionId = Guid.NewGuid().ToString(), AppInsightsInstrumentationKey = "f144292e-e3b2-4011-ac90-20e5c03fbce5", AsimovInstrumentationKey = "AIF-312cbd79-9dbb-4c48-a7da-3cc2a931cb70", DiagnosticTelemetry = diagnosticTelemetry, IdentityTelemetry = new IdentityTelemetry(identityInformationProvider, telemetryScheduler), EnvironmentTools = environmentTools, RegistryTools = (IRegistryTools2)(object)registryTools, ProcessTools = processTools, LegacyApi = legacyApi, InternalSettings = internalSettings, HostInformationProvider = hostInformationProvider, MachineInformationProvider = machineInformationProvider, UserInformationProvider = userInformationProvider, MACInformationProvider = mACInformationProvider, EventProcessorScheduler = telemetryScheduler, TelemetryManifestManagerBuilder = new TelemetryManifestManagerBuilder(), DefaultContextPropertyManager = new DefaultContextPropertyManager(GetPropertyProviders((IRegistryTools)(object)registryTools, environmentTools, hostInformationProvider, machineInformationProvider, mACInformationProvider, userInformationProvider, persistentPropertyBag, identityInformationProvider)), PersistentStorage = persistentStorage, PersistentSharedProperties = persistentPropertyBag, PersistentPropertyBag = persistentPropertyBag2, ChannelValidators = new List <IChannelValidator> { new RegistryChannelValidator(internalSettings), new InternalChannelValidator(userInformationProvider), new DisabledTelemetryChannelValidator(internalSettings) }, CustomActionToAdd = new List <IEventProcessorAction> { optOutAction, new EnforceAIRestrictionAction(), item2, item3, new MetricAction(), new SettingAction(), item, new SuppressEmptyPostPropertyEventAction() }, EventProcessorChannelBuilder = new EventProcessorChannelBuilder(persistentPropertyBag2, telemetryScheduler), WatsonSessionChannelBuilder = new WatsonSessionChannelBuilder(internalSettings.FaultEventWatsonSamplePercent(), internalSettings.FaultEventMaximumWatsonReportsPerSession(), internalSettings.FaultEventMinimumSecondsBetweenWatsonReports(), ChannelProperties.Default), OptinStatusReader = GetOptInStatusReader((IRegistryTools2)(object)registryTools), ProcessCreationTime = GetProcessCreationTime() }); }