Exemple #1
0
        public static void SendError(RaygunClient client, Exception e)
        {
            var extraData = new Dictionary <string, object>();

            AddServiceControlVersion(extraData);

            client.SendInBackground(e, null, extraData);
        }
Exemple #2
0
        public static void SendError(RaygunClient client, Exception e, StoredMessage storedMessage)
        {
            var extraData = StoredMessageToDictionary(storedMessage);

            AddServiceControlVersion(extraData);

            client.SendInBackground(e, null, extraData);
        }
Exemple #3
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending    += this.OnSuspending;
            UnhandledException += OnUnhandledException;

            RaygunClient.Attach("fR87yXCJfg88Xi6rpV0k0g==");
        }
Exemple #4
0
 public void Execute(Action <RaygunClient> callback)
 {
     if (_enabled)
     {
         var client = new RaygunClient(_apiKey);
         callback(client);
     }
 }
        static ExceptionHandler()
        {
            var assemblyInfo = typeof(App).Assembly.GetAttribute <AssemblyInformationalVersionAttribute>();

            client = new RaygunClient("uX5c/PiCVqF31xlEm3jShA==")
            {
                ApplicationVersion = assemblyInfo != null ? assemblyInfo.InformationalVersion : "Unknown Version"
            };
        }
Exemple #6
0
        static LoggingService()
        {
            ConsoleLogger consoleLogger = new ConsoleLogger();

            loggers.Add(consoleLogger);
            loggers.Add(new InstrumentationLogger());

            string consoleLogLevelEnv = Environment.GetEnvironmentVariable("MONODEVELOP_CONSOLE_LOG_LEVEL");

            if (!string.IsNullOrEmpty(consoleLogLevelEnv))
            {
                try {
                    consoleLogger.EnabledLevel = (EnabledLoggingLevel)Enum.Parse(typeof(EnabledLoggingLevel), consoleLogLevelEnv, true);
                } catch {}
            }

            string consoleLogUseColourEnv = Environment.GetEnvironmentVariable("MONODEVELOP_CONSOLE_LOG_USE_COLOUR");

            if (!string.IsNullOrEmpty(consoleLogUseColourEnv) && consoleLogUseColourEnv.ToLower() == "false")
            {
                consoleLogger.UseColour = false;
            }
            else
            {
                consoleLogger.UseColour = true;
            }

            string logFileEnv = Environment.GetEnvironmentVariable("MONODEVELOP_LOG_FILE");

            if (!string.IsNullOrEmpty(logFileEnv))
            {
                try {
                    FileLogger fileLogger = new FileLogger(logFileEnv);
                    loggers.Add(fileLogger);
                    string logFileLevelEnv = Environment.GetEnvironmentVariable("MONODEVELOP_FILE_LOG_LEVEL");
                    fileLogger.EnabledLevel = (EnabledLoggingLevel)Enum.Parse(typeof(EnabledLoggingLevel), logFileLevelEnv, true);
                } catch (Exception e) {
                    LogError(e.ToString());
                }
            }

            timestamp = DateTime.Now;

#if ENABLE_RAYGUN
            string raygunKey = BrandingService.GetString("RaygunApiKey");
            if (raygunKey != null)
            {
                raygunClient = new RaygunClient(raygunKey);
            }
#endif

            //remove the default trace listener on .NET, it throws up horrible dialog boxes for asserts
            System.Diagnostics.Debug.Listeners.Clear();

            //add a new listener that just logs failed asserts
            System.Diagnostics.Debug.Listeners.Add(new AssertLoggingTraceListener());
        }
        public static void UseRaygun(this JobHostConfiguration config, RaygunClient client)
        {
            var processor    = new RaygunExceptionHandler(client);
            var traceMonitor = new TraceMonitor()
                               .Filter(p => p.Exception != null, "Exception Handler")
                               .Subscribe(processor.Process);

            config.Tracing.Tracers.Add(traceMonitor);
        }
Exemple #8
0
 public RaygunExceptionHandler(RaygunClient client)
 {
     _client = client;
     _client.AddWrapperExceptions(typeof(FunctionInvocationException));
     if (Tags == null)
     {
         Tags = new string[0];
     }
 }
Exemple #9
0
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            RaygunClient.Initialize("RAYGUN_API_KEY").AttachPulse(); // Raygun Pulse
            RaygunClient.Attach("RAYGUN_API_KEY");                   // Raygun Crash Reporting

            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main(args, null, "AppDelegate");
        }
Exemple #10
0
        private RaygunClient CreateRaygunClient()
        {
            RaygunClient client = null;
            string       apiKey = _apiKey?.Render(LogEventInfo.CreateNullEvent()) ?? string.Empty;

            if (!string.IsNullOrEmpty(apiKey))
            {
                client = new RaygunClient(apiKey);
            }
            else
            {
#if NET45
                client = new RaygunClient();
#else
                throw new ArgumentException("NLog RaygunTarget requires valid ApiKey property", nameof(ApiKey));
#endif
            }

            if (UseExecutingAssemblyVersion)
            {
                client.ApplicationVersion = GetExecutingAssemblyVersion();
            }

            if (string.IsNullOrEmpty(client.ApplicationVersion))
            {
                if (_applicationVersion != null)
                {
                    client.ApplicationVersion = _applicationVersion.Render(LogEventInfo.CreateNullEvent());
                }
                else
                {
                    client.ApplicationVersion = GetExecutingAssemblyVersion();
                }
            }

            if (IgnoreFormFieldNames != null)
            {
                client.IgnoreFormFieldNames(SplitValues(IgnoreFormFieldNames));
            }
            if (IgnoreCookieNames != null)
            {
                client.IgnoreCookieNames(SplitValues(IgnoreCookieNames));
            }
            if (IgnoreHeaderNames != null)
            {
                client.IgnoreHeaderNames(SplitValues(IgnoreHeaderNames));
            }
            if (IgnoreServerVariableNames != null)
            {
                client.IgnoreServerVariableNames(SplitValues(IgnoreServerVariableNames));
            }
            if (_isRawDataIgnored.HasValue)
            {
                client.IsRawDataIgnored = _isRawDataIgnored.Value;
            }
            return(client);
        }
Exemple #11
0
        public static void Main()
        {
            // this sets the global culture for the app and all new threads
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;

            // and make sure the app is set correctly
            Thread.CurrentThread.CurrentCulture   = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            if (AggContext.OperatingSystem == OSType.Mac)
            {
                _raygunClient = new RaygunClient("qmMBpKy3OSTJj83+tkO7BQ==");                 // this is the Mac key
            }
            else
            {
                _raygunClient = new RaygunClient("hQIlyUUZRGPyXVXbI6l1dA==");                 // this is the PC key
            }

            AggContext.Init(embeddedResourceName: "config.json");

            // Make sure we have the right working directory as we assume everything relative to the executable.
            Directory.SetCurrentDirectory(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));

            Datastore.Instance.Initialize();

#if !DEBUG
            // Conditionally spin up error reporting if not on the Stable channel
            string channel = UserSettings.Instance.get(UserSettingsKey.UpdateFeedType);
            if (string.IsNullOrEmpty(channel) || channel != "release" || OemSettings.Instance.WindowTitleExtra == "Experimental")
#endif
            {
                System.Windows.Forms.Application.ThreadException += (s, e) =>
                {
                    if (raygunNotificationCount++ < RaygunMaxNotifications)
                    {
                        _raygunClient.Send(e.Exception);
                    }
                };

                AppDomain.CurrentDomain.UnhandledException += (s, e) =>
                {
                    if (raygunNotificationCount++ < RaygunMaxNotifications)
                    {
                        _raygunClient.Send(e.ExceptionObject as Exception);
                    }
                };
            }

            // Get startup bounds from MatterControl and construct system window
            //var systemWindow = new DesktopMainWindow(400, 200)
            var(width, height) = RootSystemWindow.GetStartupBounds();

            var systemWindow = Application.LoadRootWindow(width, height);
            systemWindow.ShowAsSystemWindow();
        }
Exemple #12
0
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            RaygunClient.Initialize("ty6buJ84nX2YkB137J21TQ==").AttachCrashReporting().AttachPulse();
            UIApplication.Main(args, null, "AppDelegate");


            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main(args, null, "AppDelegate");
        }
Exemple #13
0
 private void InitCrashProviders()
 {
     RaygunClient.Initialize("gNHcZkwjVWdhTW4nuDL/NA==").AttachCrashReporting().AttachPulse(this);
     AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) =>
     {
         var logger = new Logger();
         logger.Log(args.Exception);
         args.Handled = true;
     };
 }
Exemple #14
0
        public AppInsights()
        {
            RaygunClient.Initialize(Keys.CrashReportingKey).AttachPulse();

            var appVersion         = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleShortVersionString").ToString();
            var buildNumber        = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleVersion").ToString();
            var applicationVersion = $"{appVersion}.{buildNumber}";

            RaygunClient.Current.ApplicationVersion = applicationVersion;
        }
Exemple #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RaygunFeatureUsageTrackingSession"/> class.
 /// </summary>
 /// <param name="featureName">Name of the feature.</param>
 /// <param name="raygunClient">Raygun client instance.</param>
 /// <param name="raygunSettings">Raygun settings instance.</param>
 public RaygunFeatureUsageTrackingSession(
     string featureName,
     RaygunClient raygunClient,
     RaygunSettings raygunSettings)
     : this(
         featureName,
         Guid.Empty,
         raygunClient,
         raygunSettings)
 {
 }
        private RaygunClient CreateRaygunClient()
        {
            var client = new RaygunClient(ApiKey);

            client.IgnoreFormFieldNames(SplitValues(IgnoreFormFieldNames));
            client.IgnoreCookieNames(SplitValues(IgnoreCookieNames));
            client.IgnoreHeaderNames(SplitValues(IgnoreHeaderNames));
            client.IgnoreServerVariableNames(SplitValues(IgnoreServerVariableNames));

            return(client);
        }
Exemple #17
0
        public static RaygunClient GetClient()
        {
            var assemblyInfo = typeof(App).Assembly.GetAttribute <AssemblyInformationalVersionAttribute>();
            var client       = new RaygunClient("uX5c/PiCVqF31xlEm3jShA==")
            {
                ApplicationVersion = assemblyInfo != null ? assemblyInfo.InformationalVersion : "Unknown Version"
            };

            client.AddWrapperExceptions(typeof(AggregateException));
            return(client);
        }
Exemple #18
0
 private static void InitRaygun()
 {
     try
     {
         RaygunClient.Attach("fR87yXCJfg88Xi6rpV0k0g==");
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Error registering Raygun: " + ex.ToString());
     }
 }
        public RaygunEnvironmentMessage()
        {
            try
            {
                UtcOffset = -Math.Round((DateTime.UtcNow - DateTime.Now).TotalHours + 0.01, 1);

                Locale = Application.systemLanguage.ToString();

                ResolutionWidth  = Screen.currentResolution.width;
                ResolutionHeight = Screen.currentResolution.height;
                RefreshRate      = Screen.currentResolution.refreshRate;
                ShowCursor       = Cursor.visible;
                FullScreen       = Screen.fullScreen;
                Orientation      = Screen.orientation.ToString();

                LoadedLevelName = SceneManager.GetActiveScene().name;

                ProcessorCount   = SystemInfo.processorCount;
                Cpu              = SystemInfo.processorType;
                OSVersion        = SystemInfo.operatingSystem;
                DeviceModel      = SystemInfo.deviceModel;
                DeviceType       = SystemInfo.deviceType.ToString();
                SystemMemorySize = SystemInfo.systemMemorySize;
                Platform         = Application.platform.ToString();

                GraphicsDeviceName         = SystemInfo.graphicsDeviceName;
                GraphicsDeviceVendor       = SystemInfo.graphicsDeviceVendor;
                GraphicsDeviceVersion      = SystemInfo.graphicsDeviceVersion;
                GraphicsMemorySize         = SystemInfo.graphicsMemorySize;
                GraphicsShaderLevel        = SystemInfo.graphicsShaderLevel;
                MaxTextureSize             = SystemInfo.maxTextureSize;
                NpotSupport                = SystemInfo.npotSupport.ToString();
                SupportedRenderTargetCount = SystemInfo.supportedRenderTargetCount;
                Supports3DTextures         = SystemInfo.supports3DTextures;
                SupportsAccelerometer      = SystemInfo.supportsAccelerometer;
                SupportsComputeShaders     = SystemInfo.supportsComputeShaders;
                SupportsImageEffects       = SystemInfo.supportsImageEffects;
                SupportsGyroscope          = SystemInfo.supportsGyroscope;
                SupportsInstancing         = SystemInfo.supportsInstancing;
                SupportsLocationService    = SystemInfo.supportsLocationService;
                SupportsRenderTextures     = true;
                SupportsRenderToCubemap    = SystemInfo.supportsRenderToCubemap;
                SupportsShadows            = SystemInfo.supportsShadows;
                SupportsSparseTextures     = SystemInfo.supportsSparseTextures;
                SupportsStencil            = 1;
                SupportsVertexPrograms     = true;
                SupportsVibration          = SystemInfo.supportsVibration;
            }
            catch (Exception ex)
            {
                RaygunClient.Log(string.Format("Error getting environment info: {0}", ex.Message));
            }
        }
    /// <summary>
    /// Initializes a new instance of the <see cref="RaygunLogger"/> class.
    /// </summary>
    public RaygunLogger(ConnectVersion connectVersion)
    {
        Argument.CheckIfNull(connectVersion, "connectVersion");

            _connectVersion = connectVersion;

            Setting loggingKey = Settings.Load("raygunLoggingApiKey");
            _raygunLoggingClient = new RaygunClient(loggingKey.ToString());

            Setting tracingKey = Settings.Load("raygunTracingApiKey");
            _raygunTracingClient = new RaygunClient(tracingKey.ToString());
    }
 private void SendMessage(RaygunClient client, Exception exception)
 {
     if (!string.IsNullOrWhiteSpace(Tags))
     {
         var tags = Tags.Split(',');
         client.SendInBackground(exception, tags);
     }
     else
     {
         client.SendInBackground(exception);
     }
 }
Exemple #22
0
        public Logger()
        {
            RaygunClient.Attach(Utils.Keys.CrashReportingKey);

            var appVersion         = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleShortVersionString").ToString();
            var buildNumber        = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleVersion").ToString();
            var applicationVersion = $"{appVersion}.{buildNumber}";

            RaygunClient.Current.ApplicationVersion = applicationVersion;

            performanceStore = ServiceLocator.Instance.Resolve <IPerformanceEventStore>();
        }
Exemple #23
0
        private static RaygunClient CreateRaygunClient()
        {
            var configurations = HCRaygunConfigurations.Instance;

            if (string.IsNullOrWhiteSpace(configurations.ApiKey))
            {
                throw new InvalidOperationException("Please Complete Raygun ApiKey");
            }

            var raygunClient = new RaygunClient(configurations.ApiKey);

            return(raygunClient);
        }
Exemple #24
0
 public ShellViewModel(IEventAggregator eventAggregator, LicenseAgreement licenseAgreement, ILifetimeScope lifetimeScope, RaygunClient raygunClient, Installer installer, ProxyTester proxyTester, RuntimeUpgradeManager runtimeUpgradeManager, CredentialStore credentialStore)
 {
     DisplayName = "Platform Installer";
     this.runtimeUpgradeManager = runtimeUpgradeManager;
     this.raygunClient          = raygunClient;
     this.installer             = installer;
     this.licenseAgreement      = licenseAgreement;
     this.lifetimeScope         = lifetimeScope;
     this.eventAggregator       = eventAggregator;
     this.proxyTester           = proxyTester;
     this.credentialStore       = credentialStore;
     RunStartupSequence();
 }
Exemple #25
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            RaygunClient.Attach(RaygunApplicationKey);

            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session);

            this.InitializeComponent();

            // Migrate database
            using (var db = new LocalDbContext())
                db.Database.Migrate();
        }
Exemple #26
0
        private void ProcessWebException(ExceptionContext exceptionContext)
        {
            Exception     exception = exceptionContext.Exception;
            List <string> tags      = ExtractTagsFromException(exception);

            RaygunClient raygunClient = CreateRaygunClient();

            if (exceptionContext.HttpContext.Request.IsAuthenticated && UseIdentityNameAsUserId)
            {
                raygunClient.User = exceptionContext.HttpContext.User.Identity.Name;
            }

            SendMessage(raygunClient, exception, tags);
        }
Exemple #27
0
        private void SendMessage(RaygunClient client, Exception exception, IList <string> exceptionTags)
        {
            if (!string.IsNullOrWhiteSpace(Tags))
            {
                var tags = Tags.Split(',');

                foreach (string tag in tags)
                {
                    exceptionTags.Add(tag);
                }
            }

            client.SendInBackground(exception, exceptionTags);
        }
Exemple #28
0
        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.WriteLine("Chalkable.BackgroundTaskProcessor entry point called", "Information");
            var processor    = new TaskProcessor();
            var delay        = Settings.TaskProcessorDelay;
            var raygunClient = new RaygunClient {
                ApplicationVersion = CompilerHelper.Version
            };

            if (delay <= 0)
            {
                Trace.TraceError("Task processing is turned off");
            }

            while (true)
            {
                if (delay <= 0)
                {
                    Thread.Sleep(1000);
                    continue;
                }
                try
                {
                    Thread.Sleep(delay);
                    processor.Process();
                }
                catch (Exception ex)
                {
#if !DEBUG
                    try
                    {
                        raygunClient.SendInBackground(ex, new [] { Settings.Domain, "task-processor" });
                        Telemetry.TrackException(ex);
                    }
                    catch (Exception) {}
#else
                    Debug.Fail(ex.Message);
#endif

                    while (ex != null)
                    {
                        Trace.TraceError(ex.Message);
                        Trace.TraceError(ex.StackTrace);
                        ex = ex.InnerException;
                    }
                }
            }
        }
Exemple #29
0
        public override void Run()
        {
            Trace.WriteLine("BackgroundTaskProducer entry point called", "Information");
            var cp = new CompositeProducer();

            //cp.AddProducer("Process Reminders Producer", new AllDistrictsProducer("ProcessReminderProducer", BackgroundTaskTypeEnum.ProcessReminder));
            //cp.AddProducer("Attendance Notification Producer", new AllDistrictsProducer("AttendanceNotificationProducer", BackgroundTaskTypeEnum.AttendanceNotification));
            //cp.AddProducer("Teacher Attendance Notification Producer", new AllDistrictsProducer("TeacherAttendanceNotification", BackgroundTaskTypeEnum.TeacherAttendanceNotification));

            cp.AddProducer("Sis Import Producer", new SisImportProducer());
            cp.AddProducer("Cleanup Manager", new CleanupManager("CleanupManager"));
            cp.AddProducer("Db backup Producer", new DbBackupProducer("DbBackupProducer"));
            cp.AddProducer("Academic Benchmark Producer", new AcademicBenchmarkImportProducer("AcademicBenchmark"));

            var raygunClient = new RaygunClient {
                ApplicationVersion = CompilerHelper.Version
            };

            while (true)
            {
                try
                {
                    Thread.Sleep(20000);
                    Trace.TraceInformation("Producing cycle is starting");
                    cp.Produce();
                    Trace.TraceInformation("Producing cycle is ended");
                }
                catch (Exception ex)
                {
#if !DEBUG
                    try
                    {
                        raygunClient.SendInBackground(ex, new [] { Settings.Domain, "task-producer" });
                    }
                    catch (Exception) { }
#else
                    throw;
#endif

                    while (ex != null)
                    {
                        Trace.TraceInformation("Exception during task producing");
                        Trace.TraceInformation(ex.Message);
                        Trace.TraceInformation(ex.StackTrace);
                        ex = ex.InnerException;
                    }
                }
            }
        }
    /// <summary>
    /// Initializes a new instance of the <see cref="RaygunLogger"/> class.
    /// </summary>
    public RaygunLogger(ConnectVersion connectVersion)
    {
        Argument.CheckIfNull(connectVersion, "connectVersion");

        _connectVersion = connectVersion;

        Setting loggingKey = Settings.Load("raygunLoggingApiKey");

        _raygunLoggingClient = new RaygunClient(loggingKey.ToString());


        Setting tracingKey = Settings.Load("raygunTracingApiKey");

        _raygunTracingClient = new RaygunClient(tracingKey.ToString());
    }
Exemple #31
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RaygunClient.Attach("");
            Insights.Initialize("", Application.Context);
            Forms.Init(this, bundle);
            FormsMaps.Init(this, bundle);

            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            InitializeLocationManager();
            App.SetMediaPicker(this);

            SetPage(App.GetLoginPage(this));
        }
 public void SetUp()
 {
     raygunClient = new RaygunClient();
 }