Exemplo n.º 1
0
 /// <summary>
 /// Disables the capture of errors through <see cref="AppDomain.UnhandledException"/>
 /// </summary>
 /// <param name="options">The SentryOptions to remove the integration from.</param>
 public static void DisableAppDomainUnhandledExceptionCapture(this SentryOptions options)
 => options.Integrations = options.Integrations.RemoveAll(p => p.GetType() == typeof(AppDomainUnhandledExceptionIntegration));
Exemplo n.º 2
0
        /// <summary>
        /// Use custom <see cref="ISentryStackTraceFactory" />.
        /// </summary>
        /// <param name="options">The SentryOptions to hold the processor provider.</param>
        /// <param name="sentryStackTraceFactory">The stack trace factory.</param>
        public static SentryOptions UseStackTraceFactory(this SentryOptions options, ISentryStackTraceFactory sentryStackTraceFactory)
        {
            options.SentryStackTraceFactory = sentryStackTraceFactory ?? throw new ArgumentNullException(nameof(sentryStackTraceFactory));

            return(options);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Add an exception filter.
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor.</param>
 /// <param name="exceptionFilter">The exception filter to add.</param>
 public static void AddExceptionFilter(this SentryOptions options, IExceptionFilter exceptionFilter)
 => options.ExceptionFilters = options.ExceptionFilters != null
         ? options.ExceptionFilters.Concat(new[] { exceptionFilter }).ToArray()
         : new[] { exceptionFilter };
 /// <summary>
 /// Add an exception processor.
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor.</param>
 /// <param name="processor">The exception processor.</param>
 public static void AddExceptionProcessor(this SentryOptions options, ISentryEventExceptionProcessor processor)
 => options.ExceptionProcessors = options.ExceptionProcessors != null
         ? options.ExceptionProcessors.Concat(new[] { processor }).ToArray()
         : new[] { processor };
Exemplo n.º 5
0
 /// <summary>
 /// Disables the list addition of .Net Frameworks into events.
 /// </summary>
 /// <param name="options">The SentryOptions to remove the integration from.</param>
 public static void DisableNetFxInstallationsIntegration(this SentryOptions options)
 {
     options.EventProcessors =
         options.EventProcessors?.Where(p => p.GetType() != typeof(NetFxInstallationsEventProcessor)).ToArray();
     options.RemoveIntegration <NetFxInstallationsIntegration>();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Add an integration
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor.</param>
 /// <param name="integration">The integration.</param>
 public static void AddIntegration(this SentryOptions options, ISdkIntegration integration)
 => options.Integrations = options.Integrations != null
         ? options.Integrations.Concat(new[] { integration }).ToArray()
         : new[] { integration };
 /// <summary>
 /// Adds an event processor which is invoked when creating a <see cref="SentryEvent"/>.
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor.</param>
 /// <param name="processor">The event processor.</param>
 public static void AddEventProcessor(this SentryOptions options, ISentryEventProcessor processor)
 => options.EventProcessors = options.EventProcessors.Concat(new[] { processor }).ToArray();
Exemplo n.º 8
0
 /// <summary>
 /// Disables the capture of errors through <see cref="AppDomain.UnhandledException"/>.
 /// </summary>
 /// <param name="options">The SentryOptions to remove the integration from.</param>
 public static void DisableAppDomainUnhandledExceptionCapture(this SentryOptions options) =>
 options.RemoveIntegration <AppDomainUnhandledExceptionIntegration>();
Exemplo n.º 9
0
 /// <summary>
 /// Adds event processors which are invoked when creating a <see cref="SentryEvent"/>.
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor.</param>
 /// <param name="processors">The event processors.</param>
 internal static void AddEventProcessors(this SentryOptions options, IEnumerable <ISentryEventProcessor> processors)
 => options.EventProcessors = options.EventProcessors.AddRange(processors);
Exemplo n.º 10
0
 /// <summary>
 /// Add the exception processor provider
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor provider.</param>
 /// <param name="processorProvider">The exception processor provider.</param>
 internal static void AddExceptionProcessorProvider(this SentryOptions options, Func <IEnumerable <ISentryEventExceptionProcessor> > processorProvider)
 => options.ExceptionProcessorsProviders = options.ExceptionProcessorsProviders.Add(processorProvider);
Exemplo n.º 11
0
 /// <summary>
 /// Adds an event processor which is invoked when creating a <see cref="SentryEvent"/>.
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor.</param>
 /// <param name="processor">The event processor.</param>
 internal static void AddEventProcessor(this SentryOptions options, ISentryEventProcessor processor)
 => options.EventProcessors = options.EventProcessors.Add(processor);
Exemplo n.º 12
0
 /// <summary>
 /// Add prefix to exclude from 'InApp' stack trace list
 /// </summary>
 /// <param name="options"></param>
 /// <param name="prefix"></param>
 public static void AddInAppExclude(this SentryOptions options, string prefix)
 => options.InAppExclude = options.InAppExclude.Add(prefix);
Exemplo n.º 13
0
 /// <summary>
 /// Add an integration
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor.</param>
 /// <param name="integration">The integration.</param>
 public static void AddIntegration(this SentryOptions options, ISdkIntegration integration)
 => options.Integrations = options.Integrations.Add(integration);
Exemplo n.º 14
0
 internal static string?TryGetProcessSpecificCacheDirectoryPath(this SentryOptions options)
 {
     // In the future, this will most likely contain process ID
     return(options.TryGetDsnSpecificCacheDirectoryPath());
 }
 /// <summary>
 /// Adds event processors which are invoked when creating a <see cref="SentryEvent"/>.
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor.</param>
 /// <param name="processors">The event processors.</param>
 public static void AddEventProcessors(this SentryOptions options, IEnumerable <ISentryEventProcessor> processors)
 => options.EventProcessors = options.EventProcessors.Concat(processors).ToArray();
Exemplo n.º 16
0
 /// <summary>
 /// Disables the strategy to detect duplicate events.
 /// </summary>
 /// <remarks>
 /// In case a second event is being sent out from the same exception, that event will be discarded.
 /// It is possible the second event had in fact more data. In which case it'd be ideal to avoid the first
 /// event going out in the first place.
 /// </remarks>
 /// <param name="options">The SentryOptions to remove the processor from.</param>
 public static void DisableDuplicateEventDetection(this SentryOptions options)
 => options.EventProcessors =
     options.EventProcessors?.Where(p => p.GetType() != typeof(DuplicateEventDetectionEventProcessor)).ToArray();
 /// <summary>
 /// Invokes all event processor providers available
 /// </summary>
 /// <param name="options">The SentryOptions which holds the processor providers.</param>
 /// <returns></returns>
 public static IEnumerable <ISentryEventProcessor> GetAllEventProcessors(this SentryOptions options)
 => options.EventProcessorsProviders.SelectMany(p => p());
Exemplo n.º 18
0
 /// <summary>
 /// Disables the capture of errors through <see cref="TaskScheduler.UnobservedTaskException"/>.
 /// </summary>
 /// <param name="options">The SentryOptions to remove the integration from.</param>
 public static void DisableTaskUnobservedTaskExceptionCapture(this SentryOptions options) =>
 options.RemoveIntegration <TaskUnobservedTaskExceptionIntegration>();
Exemplo n.º 19
0
 /// <summary>
 /// Ignore exception of type <typeparamref name="TException"/> or derived.
 /// </summary>
 /// <typeparam name="TException">The type of the exception to ignore.</typeparam>
 /// <param name="options">The SentryOptions to store the exceptions type ignore.</param>
 public static void AddExceptionFilterForType <TException>(this SentryOptions options) where TException : Exception
 => options.AddExceptionFilter(new ExceptionTypeFilter <TException>());
Exemplo n.º 20
0
 /// <summary>
 /// Disables the capture of errors through <see cref="AppDomain.ProcessExit"/>
 /// </summary>
 /// <param name="options">The SentryOptions to remove the integration from.</param>
 public static void DisableAppDomainProcessExitFlush(this SentryOptions options) =>
 options.RemoveIntegration <AppDomainProcessExitIntegration>();
Exemplo n.º 21
0
 /// <summary>
 /// Add prefix to include as in 'InApp' stack trace.
 /// </summary>
 public static void AddInAppInclude(this SentryOptions options, string prefix)
 => options.InAppInclude = options.InAppInclude != null
         ? options.InAppInclude.Concat(new[] { prefix }).ToArray()
         : new[] { prefix };
Exemplo n.º 22
0
 /// <summary>
 /// Removes all integrations of type <typeparamref name="TIntegration"/>.
 /// </summary>
 /// <typeparam name="TIntegration">The type of the integration(s) to remove.</typeparam>
 /// <param name="options">The SentryOptions to remove the integration(s) from.</param>
 /// <returns></returns>
 internal static void RemoveIntegration <TIntegration>(this SentryOptions options) where TIntegration : ISdkIntegration
 => options.Integrations = options.Integrations?.Where(p => p.GetType() != typeof(TIntegration)).ToArray();
Exemplo n.º 23
0
 /// <summary>
 /// Add the exception processor provider.
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor provider.</param>
 /// <param name="processorProvider">The exception processor provider.</param>
 public static void AddExceptionProcessorProvider(this SentryOptions options,
                                                  Func <IEnumerable <ISentryEventExceptionProcessor> > processorProvider)
 => options.ExceptionProcessorsProviders = options.ExceptionProcessorsProviders != null
         ? options.ExceptionProcessorsProviders.Concat(new[] { processorProvider }).ToArray()
         : new[] { processorProvider };
Exemplo n.º 24
0
 /// <summary>
 /// Creates a new instance of <see cref="SentryClient"/>.
 /// </summary>
 /// <param name="options">The configuration for this client.</param>
 public SentryClient(SentryOptions options)
     : this(options, null)
 {
 }
Exemplo n.º 25
0
 /// <summary>
 /// Invokes all exception processor providers available.
 /// </summary>
 /// <param name="options">The SentryOptions which holds the processor providers.</param>
 public static IEnumerable <ISentryEventExceptionProcessor> GetAllExceptionProcessors(this SentryOptions options)
 => options.ExceptionProcessorsProviders?.SelectMany(p => p()) ?? Enumerable.Empty <ISentryEventExceptionProcessor>();
 /// <summary>
 /// Add the exception processors.
 /// </summary>
 /// <param name="options">The SentryOptions to hold the processor.</param>
 /// <param name="processors">The exception processors.</param>
 public static void AddExceptionProcessors(this SentryOptions options, IEnumerable <ISentryEventExceptionProcessor> processors)
 => options.ExceptionProcessors = options.ExceptionProcessors != null
         ? options.ExceptionProcessors.Concat(processors).ToArray()
         : processors.ToArray();
Exemplo n.º 27
0
 /// <summary>
 /// Disables the strategy to detect duplicate events
 /// </summary>
 /// <remarks>
 /// In case a second event is being sent out from the same exception, that event will be discarded.
 /// It is possible the second event had in fact more data. In which case it'd be ideal to avoid the first
 /// event going out in the first place.
 /// </remarks>
 /// <param name="options">The SentryOptions to remove the processor from.</param>
 public static void DisableDuplicateEventDetection(this SentryOptions options)
 => options.EventProcessors = options.EventProcessors.RemoveAll(p => p.GetType() == typeof(DuplicateEventDetectionEventProcessor));