protected override ILogger CreateLogger(TelemetrySession telemetrySession) => AggregateLogger.Create( CodeMarkerLogger.Instance, new EtwLogger(_optionsService), new VSTelemetryLogger(telemetrySession), Logger.GetLogger() );
public void PostTelemetryEvent(string telemetryEventName, Dictionary <string, object> telemetryProperties) { if (telemetrySession == null) { if (Process.GetCurrentProcess().ProcessName == "devenv") { telemetrySession = TelemetryService.DefaultSession; } else { if (string.IsNullOrEmpty(SerializedTelemetrySession)) { telemetrySession = TelemetryService.DefaultSession; telemetrySession.IsOptedIn = true; telemetrySession.Start(); SerializedTelemetrySession = telemetrySession.SerializeSettings(); } else { telemetrySession = new TelemetrySession(SerializedTelemetrySession); telemetrySession.Start(); } } } var prefix = telemetryEventName.Replace("/", ".") + "."; TelemetryEvent telemetryEvent = new TelemetryEvent(telemetryEventName); foreach (var property in telemetryProperties) { telemetryEvent.Properties[prefix + property.Key] = property.Value; } telemetrySession.PostEvent(telemetryEvent); }
public static void UnregisterTelemetrySesssion(TelemetrySession session) { lock (_guard) { s_telemetrySessions = s_telemetrySessions.Remove(session); } }
public Implementation(TelemetrySession session, IGlobalOptionService globalOptions) { _session = session; // Only log "delta" property for block end events if feature flag is enabled. LogDelta = globalOptions.GetOption(DiagnosticOptions.LogTelemetryForBackgroundAnalyzerExecution); }
private void SetGlobalContext(int uiCultureLCID, int cultureLCID, string serializedSession) { var session = new TelemetrySession(serializedSession); session.Start(); EnsureCulture(uiCultureLCID, cultureLCID); WatsonReporter.InitializeFatalErrorHandlers(session); WatsonReporter.InitializeLogger(Logger); // set roslyn loggers RoslynServices.SetTelemetrySession(session); RoslynLogger.SetLogger(AggregateLogger.Create(new VSTelemetryLogger(session), RoslynLogger.GetLogger())); // start performance reporter var diagnosticAnalyzerPerformanceTracker = SolutionService.PrimaryWorkspace.Services.GetService <IPerformanceTrackerService>(); if (diagnosticAnalyzerPerformanceTracker != null) { var globalOperationNotificationService = SolutionService.PrimaryWorkspace.Services.GetService <IGlobalOperationNotificationService>(); _performanceReporter = new PerformanceReporter(Logger, diagnosticAnalyzerPerformanceTracker, globalOperationNotificationService, s_reportInterval, _shutdownCancellationSource.Token); } }
protected override ILogger CreateLogger(TelemetrySession telemetrySession) => AggregateLogger.Create( CodeMarkerLogger.Instance, new EtwLogger(FunctionIdOptions.CreateFunctionIsEnabledPredicate(_globalOptions)), TelemetryLogger.Create(telemetrySession, _globalOptions), new FileLogger(_globalOptions), Logger.GetLogger());
public static void RegisterTelemetrySesssion(TelemetrySession session) { lock (_guard) { s_telemetrySessions = s_telemetrySessions.Add(session); } }
/// <summary> /// Start a new telemetry collection session, collecting at the specified interval /// </summary> /// <param name="droneName"></param> /// <param name="sessionName"></param> /// <param name="intervalMilliseconds"></param> /// <param name="propertyNames"></param> public void Start(string droneName, string sessionName, long intervalMilliseconds, IEnumerable <string> propertyNames = null) { Drone drone = _context.Drones.FirstOrDefault(d => d.Name == droneName); if (drone == null) { drone = new Drone { Name = droneName }; _context.Drones.Add(drone); _context.SaveChanges(); } _session = new TelemetrySession { DroneId = drone.Id, Name = sessionName, Start = DateTime.Now }; _context.Sessions.Add(_session); _context.SaveChanges(); _propertiesToCapture = propertyNames; _intervalMilliseconds = intervalMilliseconds; _lastWritten = 0; _monitor.DroneStatusUpdated += OnDroneStatusUpdated; }
internal DefaultExperimentationFilterProvider(TelemetrySession telemetrySession, IProcessInformationProvider processInformation) { CodeContract.RequiresArgumentNotNull <TelemetrySession>(telemetrySession, "telemetrySession"); this.telemetrySession = telemetrySession; CodeContract.RequiresArgumentNotNull <IProcessInformationProvider>(processInformation, "processInformation"); this.processInformation = processInformation; }
public void InitializeTelemetrySession(string host, string serializedSession, CancellationToken cancellationToken) { RunService(() => { var services = SolutionService.PrimaryWorkspace.Services; var telemetryService = (RemoteWorkspaceTelemetryService)services.GetRequiredService <IWorkspaceTelemetryService>(); var telemetrySession = new TelemetrySession(serializedSession); telemetrySession.Start(); telemetryService.InitializeTelemetrySession(telemetrySession); telemetryService.RegisterUnexpectedExceptionLogger(Logger); // log telemetry that service hub started RoslynLogger.Log(FunctionId.RemoteHost_Connect, KeyValueLogMessage.Create(m => { m["Host"] = host; m["InstanceId"] = InstanceId; })); // start performance reporter var diagnosticAnalyzerPerformanceTracker = services.GetService <IPerformanceTrackerService>(); if (diagnosticAnalyzerPerformanceTracker != null) { var globalOperationNotificationService = services.GetService <IGlobalOperationNotificationService>(); _performanceReporter = new PerformanceReporter(Logger, telemetrySession, diagnosticAnalyzerPerformanceTracker, globalOperationNotificationService, s_reportInterval, _shutdownCancellationSource.Token); } }, cancellationToken); }
public Telemetry(IPluginTelemetryProvider provider, Process simulatorProcess) { Provider = provider; // Initialize memory objects var mem = new MemoryReader(); mem.Open(simulatorProcess); Memory = new MemoryProvider(mem); // Initialize telemetry provider; this class gives us the address layout to read. Memory.Scanner.Enable(); Provider.Initialize(Memory); Memory.Scanner.Disable(); // Start outside-world telemetry objects Session = new TelemetrySession(); Simulator = new TelemetryGame(); Acquisition = new TelemetryAcquisition(); Support = new TelemetrySupport(); // Start 40Hz clock signal (25ms) Clock = new MMTimer(25); Clock.Tick += (o, s) => GlobalEvents.Fire(new TelemetryRefresh(this), true); Clock.Start(); // Hook both events together: GlobalEvents.Hook <TelemetryRefresh>(Update, true); }
public void CollectionTest() { DateTime start = DateTime.Now; _collector.Start(DroneName, SessionName, 1000, null); DateTime end = DateTime.Now; Thread.Sleep(3000); _collector.Stop(); Assert.AreEqual(1, _context.Drones.Count()); Drone drone = _context.Drones.First(); Assert.AreEqual(DroneName, drone.Name); Assert.AreEqual(1, _context.Sessions.Count()); TelemetrySession session = _context.Sessions.First(); Assert.AreEqual(drone.Id, session.DroneId); Assert.AreEqual(SessionName, session.Name); Assert.IsTrue(session.Start >= start); Assert.IsTrue(session.Start <= end); Assert.IsTrue(_context.Properties.Count() > 0); IEnumerable <string> propertyNames = _context.Properties.Select(p => p.Name).Distinct(); Assert.IsTrue(propertyNames.Count() > 1); Assert.IsTrue(_context.DataPoints.Count() > 0); }
public VSTelemetryLogger(TelemetrySession session) { _session = session; _pendingScopes = new ConcurrentDictionary <int, object>( concurrencyLevel: 2, capacity: 10 ); }
internal VSTelemetryRecorder() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown defaultSession = (TelemetrySession)(object)new TelemetrySession(TelemetryService.DefaultSession.SerializeSettings()); defaultSession.UseVsIsOptedIn(); defaultSession.Start(); }
public AsimovAppInsightsClientWrapper(bool isUtcEnabled, string instrumentationKey, TelemetrySession hostTelemetrySession, StorageBase storage, IProcessLockFactory processLockFactory) : base(instrumentationKey) { this.isUtcEnabled = isUtcEnabled; this.hostTelemetrySession = hostTelemetrySession; this.storage = storage; this.processLockFactory = processLockFactory; }
public WatsonSessionChannel(TelemetrySession telemetrySession, int faultEventWatsonSamplePercent, int faultEventMaximumWatsonReportsPerSession, int faultEventMinimumSecondsBetweenWatsonReports) { TelemetrySession = telemetrySession; FaultEventWatsonSamplePercent = faultEventWatsonSamplePercent; FaultEventMaximumWatsonReportsPerSession = faultEventMaximumWatsonReportsPerSession; FaultEventMinimumSecondsBetweenWatsonReports = faultEventMinimumSecondsBetweenWatsonReports; DateTimeOfLastWatsonReport = DateTime.MinValue; }
public DefaultExperimentationOptinStatusReader(TelemetrySession telemetrySession, IRegistryTools registryTools) { CodeContract.RequiresArgumentNotNull <TelemetrySession>(telemetrySession, "telemetrySession"); CodeContract.RequiresArgumentNotNull <IRegistryTools>(registryTools, "registryTools"); this.telemetrySession = telemetrySession; this.registryTools = registryTools; isOptedIn = new Lazy <bool>(() => GetIsOptedIn()); }
public async Task <ISession> LoadAtlasTelemetryAsync(byte[] telemetryBytes) { ISession session = new TelemetrySession() { TelemetrySessionData = await _telemetrySessionParser.ParseTelemetrySessionAsync(telemetryBytes) }; return(session); }
} //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown internal DefaultRemoteSettingsFilterProvider(TelemetrySession telemetrySession, IProcessInformationProvider processInformationProvider, IOSInformationProvider osInformationProvider) { CodeContract.RequiresArgumentNotNull <TelemetrySession>(telemetrySession, "telemetrySession"); session = telemetrySession; CodeContract.RequiresArgumentNotNull <IProcessInformationProvider>(processInformationProvider, "processInformationProvider"); this.processInformationProvider = processInformationProvider; CodeContract.RequiresArgumentNotNull <IOSInformationProvider>(osInformationProvider, "osInformationProvider"); this.osInformationProvider = osInformationProvider; }
public void DetachChannel(ITelemetryTestChannel channel) { if (telemetrySession != null) { TelemetrySession obj = telemetrySession; obj.RawTelemetryEventReceived = (EventHandler <TelemetryTestChannelEventArgs>)Delegate.Remove(obj.RawTelemetryEventReceived, new EventHandler <TelemetryTestChannelEventArgs>(channel.OnPostEvent)); } this.channel = null; }
public void InitializeTelemetrySession(TelemetrySession telemetrySession) { Contract.ThrowIfFalse(CurrentSession is null); Logger.SetLogger(CreateLogger(telemetrySession)); WatsonReporter.RegisterTelemetrySesssion(telemetrySession); CurrentSession = telemetrySession; }
internal EventProcessorChannel(IEventProcessor theEventProcessor, ITelemetryScheduler theScheduler, TelemetrySession telemetrySession) { CodeContract.RequiresArgumentNotNull <IEventProcessor>(theEventProcessor, "theEventProcessor"); CodeContract.RequiresArgumentNotNull <ITelemetryScheduler>(theScheduler, "theScheduler"); CodeContract.RequiresArgumentNotNull <TelemetrySession>(telemetrySession, "telemetrySession"); eventProcessor = theEventProcessor; scheduler = theScheduler; scheduler.InitializeTimed(TimeSpan.FromSeconds(1.0)); this.telemetrySession = telemetrySession; }
public void InitializeTelemetrySession(TelemetrySession telemetrySession, bool logDelta) { Contract.ThrowIfFalse(CurrentSession is null); Logger.SetLogger(CreateLogger(telemetrySession, logDelta)); FaultReporter.RegisterTelemetrySesssion(telemetrySession); CurrentSession = telemetrySession; TelemetrySessionInitialized(); }
public void AttachChannel(ITelemetryTestChannel channel) { this.channel = channel; if (telemetrySession == null) { telemetrySession = TelemetryService.DefaultSession; } TelemetrySession obj = telemetrySession; obj.RawTelemetryEventReceived = (EventHandler <TelemetryTestChannelEventArgs>)Delegate.Combine(obj.RawTelemetryEventReceived, new EventHandler <TelemetryTestChannelEventArgs>(channel.OnPostEvent)); }
/// <inheritdoc /> public void SetSession(TelemetrySession session) { lock (lockObject) { if (Subscriptions.Count > 0) { throw new InvalidOperationException("Cannot set the session after subscriptions have been made"); } provider = new TelemetryNotificationProvider(session); } }
public void TestPopulateNameFromData() { string expectedPlaneName = "TestPlane"; TelemetrySession logSession = new TelemetrySession(); logSession.mainHeader = Encoding.ASCII.GetBytes("012345678901TestPlane\0"); logSession.poplulateNameFromMainHeader(); Assert.AreEqual(expectedPlaneName, logSession.planeName); }
public static void Initialize(IServiceProvider serviceProvider, TelemetrySession session) { var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel)); var optionService = componentModel.GetService <IGlobalOptionService>(); Logger.SetLogger( AggregateLogger.Create( CodeMarkerLogger.Instance, new EtwLogger(optionService), new VSTelemetryLogger(session), Logger.GetLogger())); Logger.Log(FunctionId.Run_Environment, KeyValueLogMessage.Create(m => m["Version"] = FileVersionInfo.GetVersionInfo(typeof(VisualStudioWorkspace).Assembly.Location).FileVersion)); }
public async Task <ISession> LoadAtlasTelemetryAsync(string telemetryFileName) { var telemetry = await _telemetryFileParser.ParseTelemetryFileAsync(telemetryFileName, IbtParseOptions.All); ISession session = new TelemetrySession() { FileName = String.Empty, SessionFileName = telemetryFileName, Name = Path.GetFileNameWithoutExtension(telemetry.FileName), TelemetrySessionData = telemetry.SessionData }; return(session); }
public MetricsPublisher() { #if NET451 try { this.session = new TelemetrySession(TelemetryService.DefaultSession.SerializeSettings()); this.session.IsOptedIn = true; this.session.Start(); } catch (Exception e) { if (EqtTrace.IsWarningEnabled) { EqtTrace.Warning(string.Format(CultureInfo.InvariantCulture, "TelemetrySession: Error in starting Telemetry session : {0}", e.Message)); } } #endif }
/// <summary> /// Initializes a new instance of the <see cref="TelemetryClient"/> class. /// </summary> public TelemetryClient() { // Only enable telemetry if the user has opted into it in Visual Studio TelemetryService.DefaultSession.UseVsIsOptedIn(); if (TelemetryService.DefaultSession.IsOptedIn) { _telemetrySession = TelemetryService.DefaultSession; GitRepositoryInfo repositoryInfo = GitRepositoryInfo.GetRepoInfoForCurrentDirectory(); if (repositoryInfo?.Origin != null) { TelemetryContext context = _telemetrySession.CreateContext("GitRepository"); context.SharedProperties["VS.TeamFoundation.Git.OriginRemoteUrlHashV2"] = new TelemetryPiiProperty(repositoryInfo.Origin); } } }
private VsTelemetryRecorder() { _session = TelemetryService.DefaultSession; }