Beispiel #1
0
 internal static void TelemetryStartup(bool enableRemoteTelemetry)
 {
     if (!Debugger.IsAttached && enableRemoteTelemetry)
     {
         AriaV2StaticState.Enable(global::BuildXL.Tracing.AriaTenantToken.Key);
     }
 }
Beispiel #2
0
 internal static void TelemetryShutdown()
 {
     if (AriaV2StaticState.IsEnabled)
     {
         AriaV2StaticState.TryShutDown(TimeSpan.FromSeconds(10), out _);
     }
 }
Beispiel #3
0
 private void TelemetryShutdown()
 {
     if (AriaV2StaticState.IsEnabled && m_configuration.EnableTelemetry)
     {
         m_telemetryStopwatch.Stop();
         Logger.Log.SandboxedProcessExecutorInvoked(m_loggingContext, m_telemetryStopwatch.ElapsedMilliseconds, Environment.CommandLine);
         AriaV2StaticState.TryShutDown(TimeSpan.FromSeconds(10), out _);
     }
 }
Beispiel #4
0
 private void TelemetryStartup()
 {
     if (!Debugger.IsAttached && m_configuration.EnableTelemetry)
     {
         AriaV2StaticState.Enable(BuildXL.Tracing.AriaTenantToken.Key);
         TrackingEventListener.RegisterEventSource(ETWLogger.Log);
         m_telemetryStopwatch.Start();
     }
 }
Beispiel #5
0
 private void TelemetryShutdown()
 {
     if (AriaV2StaticState.IsEnabled && !m_telemetryDisabled)
     {
         m_telemetryStopwatch.Stop();
         Tracing.Logger.Log.ExecutionAnalyzerInvoked(LoggingContext, m_mode.ToString(), m_telemetryStopwatch.ElapsedMilliseconds, Environment.CommandLine);
         LogEventSummary();
         // Analyzer telemetry is not critical to BuildXL, so no special handling for telemetry shutdown issues
         AriaV2StaticState.TryShutDown(TimeSpan.FromSeconds(10), out Exception telemetryShutdownException);
     }
 }
Beispiel #6
0
        private void TelemetryStartup()
        {
            AppDomain.CurrentDomain.UnhandledException +=
                (sender, eventArgs) =>
            {
                HandleUnhandledFailure(
                    eventArgs.ExceptionObject as Exception
                    );
            };

            if (!Debugger.IsAttached && !m_telemetryDisabled)
            {
                AriaV2StaticState.Enable(global::BuildXL.Tracing.AriaTenantToken.Key);
                TrackingEventListener.RegisterEventSource(ETWLogger.Log);
                m_telemetryStopwatch.Start();
            }
        }
Beispiel #7
0
        public static IDisposable SetupLogging(EventLevel level, IEventWriter writer)
        {
            var eventListener = new TextWriterEventListener(eventSource: Events.Log, writer: writer, baseTime: DateTime.UtcNow, level: level);

            var primarySource = bxl.ETWLogger.Log;

            if (primarySource.ConstructionException != null)
            {
                // Rethrow an exception preserving the original stack trace.
                var edi = ExceptionDispatchInfo.Capture(primarySource.ConstructionException);
                edi.Throw();

                // This code is unreachable, but compiler doesn't know about it.
                throw null;
            }

            eventListener.RegisterEventSource(primarySource);
            eventListener.EnableTaskDiagnostics(BuildXL.Tracing.ETWLogger.Tasks.CommonInfrastructure);
            AriaV2StaticState.Enable(AriaTenantToken.Key);

            var eventSources = new EventSource[]
            {
                bxl.ETWLogger.Log,
                BuildXL.Engine.Cache.ETWLogger.Log,
                BuildXL.Engine.ETWLogger.Log,
                BuildXL.Scheduler.ETWLogger.Log,
                BuildXL.Tracing.ETWLogger.Log,
                bxlScriptAnalyzer.ETWLogger.Log,
                BuildXL.Ide.LanguageServer.ETWLogger.Log,
                BuildXL.FrontEnd.Core.ETWLogger.Log,
                BuildXL.FrontEnd.Script.ETWLogger.Log,
                BuildXL.FrontEnd.Nuget.ETWLogger.Log,
            };

            using (var listener = new TrackingEventListener(Events.Log))
            {
                foreach (var eventSource in eventSources)
                {
                    Events.Log.RegisterMergedEventSource(eventSource);
                }
            }

            return(eventListener);
        }
Beispiel #8
0
        private static ExitKind RunAppServer(AppServer.StartupParameters startupParameters)
        {
            ExitKind exitKind;

            using (
                var server =
                    new AppServer(maximumIdleTime: new TimeSpan(hours: 0, minutes: startupParameters.ServerMaxIdleTimeInMinutes, seconds: 0)))
            {
                exitKind = server.Run(startupParameters);
            }

            Exception telemetryShutdownException;

            if (AriaV2StaticState.TryShutDown(out telemetryShutdownException) == AriaV2StaticState.ShutDownResult.Failure)
            {
                exitKind = ExitKind.InfrastructureError;
            }

            return(exitKind);
        }
        public void LongNameIsShortened(string name, string expected, int maxLength)
        {
            string result = AriaV2StaticState.ScrubEventProperty(name, maxLength);

            Assert.Equal(expected, result);
        }
Beispiel #10
0
 /// <inheritdoc />
 public void Dispose()
 {
     m_loggingListeners.Dispose();
     AriaV2StaticState.TryShutDown(out _);
 }