public void Init(HttpApplication context)
        {
            context.Error += SendError;

            HttpStatusCodesToExclude           = RaygunSettings.Settings.ExcludedStatusCodes;
            ExcludeErrorsBasedOnHttpStatusCode = HttpStatusCodesToExclude.Any();
            ExcludeErrorsFromLocal             = RaygunSettings.Settings.ExcludeErrorsFromLocal;

            // If no version is set, attempt to retrieve the version from the assembly.
            if (string.IsNullOrEmpty(RaygunSettings.Settings.ApplicationVersion))
            {
                var entryAssembly = GetWebEntryAssembly(context);
                if (entryAssembly != null)
                {
                    RaygunSettings.Settings.ApplicationVersion = entryAssembly.GetName()?.Version?.ToString();
                }
            }

            var mvcAssembly = AppDomain.CurrentDomain?.GetAssemblies()?.FirstOrDefault(a => a.FullName.StartsWith("Mindscape.Raygun4Net.Mvc,"));

            if (mvcAssembly != null)
            {
                var type   = mvcAssembly.GetType("Mindscape.Raygun4Net.RaygunExceptionFilterAttacher");
                var method = type.GetMethod("AttachExceptionFilter", BindingFlags.Static | BindingFlags.Public);
                method.Invoke(null, new object[] { context, this });
            }

            APM.Initialize(context, RaygunSettings.Settings.ApplicationIdentifier);
        }
 private void EndRequest(object sender, EventArgs e)
 {
     try
     {
         if (_samplingManager != null)
         {
             APM.Enable();
         }
     }
     catch (Exception ex)
     {
         RaygunLogger.Instance.Error($"Error during end request of APM sampling: {ex.Message}");
     }
 }
 private void EndRequest(object sender, EventArgs e)
 {
     try
     {
         if (_samplingManager != null)
         {
             APM.Enable();
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Trace.WriteLine($"Error during end request of APM sampling: {ex.Message}");
     }
 }
Ejemplo n.º 4
0
        public void Init(HttpApplication context)
        {
            context.Error += SendError;

            HttpStatusCodesToExclude           = RaygunSettings.Settings.ExcludedStatusCodes;
            ExcludeErrorsBasedOnHttpStatusCode = HttpStatusCodesToExclude.Any();
            ExcludeErrorsFromLocal             = RaygunSettings.Settings.ExcludeErrorsFromLocal;

            var mvcAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.FullName.StartsWith("Mindscape.Raygun4Net.Mvc,"));

            if (mvcAssembly != null)
            {
                var type   = mvcAssembly.GetType("Mindscape.Raygun4Net.RaygunExceptionFilterAttacher");
                var method = type.GetMethod("AttachExceptionFilter", BindingFlags.Static | BindingFlags.Public);
                method.Invoke(null, new object[] { context, this });
            }

            APM.Initialize(context, RaygunSettings.Settings.ApplicationIdentifier);
        }
        private void BeginRequest(object sender, EventArgs e)
        {
            try
            {
                if (_samplingManager != null)
                {
                    var application = (HttpApplication)sender;

                    var urlExcludingQuery = application.Request.Url.GetLeftPart(UriPartial.Path);
                    if (!_samplingManager.TakeSample(urlExcludingQuery))
                    {
                        APM.Disable();
                    }
                }
            }
            catch (Exception ex)
            {
                RaygunLogger.Instance.Error($"Error during begin request of APM sampling: {ex.Message}");
            }
        }
Ejemplo n.º 6
0
        public void Init(HttpApplication context)
        {
            context.Error += SendError;

            HttpStatusCodesToExclude = new int[0];
            if (!string.IsNullOrEmpty(RaygunSettings.Settings.ExcludeHttpStatusCodesList))
            {
                List <int> codes = new List <int>();
                string[]   parts = RaygunSettings.Settings.ExcludeHttpStatusCodesList.Split(',');
                foreach (string code in parts)
                {
                    int c;
                    if (int.TryParse(code, out c))
                    {
                        codes.Add(c);
                    }
                }
                HttpStatusCodesToExclude = codes.ToArray();
            }
            ExcludeErrorsBasedOnHttpStatusCode = HttpStatusCodesToExclude.Length > 0;
            ExcludeErrorsFromLocal             = RaygunSettings.Settings.ExcludeErrorsFromLocal;

            APM.Initialize(context, RaygunSettings.Settings.ApplicationIdentifier);
        }