public MacMachinePropertyProvider(IMachineInformationProvider machineInformationProvider, IRegistryTools regTools, IMACInformationProvider macInformationProvider) { CodeContract.RequiresArgumentNotNull <IMachineInformationProvider>(machineInformationProvider, "machineInformationProvider"); CodeContract.RequiresArgumentNotNull <IRegistryTools>(regTools, "regTools"); CodeContract.RequiresArgumentNotNull <IMACInformationProvider>(macInformationProvider, "macInformationProvider"); this.machineInformationProvider = machineInformationProvider; this.macInformationProvider = macInformationProvider; memoryInformation = new Lazy <PerformanceCounter>(() => InitializeOSMemoryInformation(), false); systemInformation = new Lazy <SystemInfo>(() => InitializeSystemInformation(), false); }
public WindowsMachinePropertyProvider(IMachineInformationProvider machineInformationProvider, IRegistryTools regTools, IMACInformationProvider macInformationProvider) { CodeContract.RequiresArgumentNotNull <IMachineInformationProvider>(machineInformationProvider, "machineInformationProvider"); CodeContract.RequiresArgumentNotNull <IRegistryTools>(regTools, "regTools"); CodeContract.RequiresArgumentNotNull <IMACInformationProvider>(macInformationProvider, "macInformationProvider"); this.machineInformationProvider = machineInformationProvider; registryTools = regTools; this.macInformationProvider = macInformationProvider; memoryInformation = new Lazy <NativeMethods.MemoryStatus>(() => InitializeOSMemoryInformation(), false); systemInformation = new Lazy <NativeMethods.SystemInfo>(() => InitializeSystemInformation(), false); processorDescription = new Lazy <string>(() => InitializeProcessorDescription(), false); processorFrequency = new Lazy <int?>(() => registryTools.GetRegistryIntValueFromLocalMachineRoot("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "~MHz", (int?)null), false); azureVMImageName = new Lazy <string>(() => InitializeAzureVMImageName(), false); }
/// <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; }
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)); } }