abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.91k stars 3.44k forks source link

Sentry in Abp.io project #17581

Open OmarSeleim2010 opened 1 year ago

OmarSeleim2010 commented 1 year ago

I want to use sentry in abp project and make steps correctly as follow but exceptions dosen't show in sentry dashboard (in issues page) steps : 1- run command Install-Package Sentry.AspNetCore -Version 3.36.0 add this code

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
  .ConfigureWebHostDefaults(webBuilder =>
  {
      // Add the following line:
      webBuilder.UseSentry(o =>
      {
          o.Dsn = "https://xxxxxx.ingest.sentry.io/xxxx";
          // When configuring for the first time, to see what the SDK is doing:
          o.Debug = true;
          // Set TracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
          // We recommend adjusting this value in production.
          o.TracesSampleRate = 1.0;
      });
  });

when I try throw new Exception("Testing Sentry Exception"); no exception appear in Issues page but when I try this SentrySdk.CaptureException(new Exception("Test Exception by SentrySdk")); it work and shown in issues page what is the problem? also when I do same steps on .net core project (not abp project) every thisg work fine

maliming commented 1 year ago

when I try throw new Exception("Testing Sentry Exception");

hi

Where do you throw the exception? mvc controller or app service?

OmarSeleim2010 commented 1 year ago

hi

Where do you throw the exception? mvc controller or app service?

I try throw new Exception("Testing Sentry Exception"); in Page.cshtml.cs because I'm using .Net core project razor page

maliming commented 1 year ago

The builtin exception filter will handle the exception, You can override the default behavior.

https://github.com/search?q=repo%3Aabpframework%2Fabp%20HandleAndWrapException&type=code

bruno-garcia commented 1 year ago

Is this IAsyncExceptionFilter something Sentry should be implementing too? I imagine this is supported by 1 or more handlers?

maliming commented 1 year ago

hi bruno-garcia

You can override the default behavior.

stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

bruno-garcia commented 10 months ago

It does log the exception: https://github.com/abpframework/abp/blob/c18734c4e24e8462b671246c94d463cc8ff3326d/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs#L60

So it should show up in Sentry