Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bugsnag #488

Merged
merged 1 commit into from
Sep 12, 2024
Merged

Add bugsnag #488

merged 1 commit into from
Sep 12, 2024

Conversation

johnml1135
Copy link
Collaborator

@johnml1135 johnml1135 commented Sep 11, 2024

Initial Implementation for all controller exceptions.

#485


This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.15%. Comparing base (2da4beb) to head (3168e85).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #488      +/-   ##
==========================================
- Coverage   57.15%   57.15%   -0.01%     
==========================================
  Files         277      277              
  Lines       14150    14152       +2     
  Branches     1900     1900              
==========================================
+ Hits         8088     8089       +1     
  Misses       5474     5474              
- Partials      588      589       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 16 of 19 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @johnml1135)


src/Machine/src/Serval.Machine.EngineServer/Program.cs line 32 at r2 (raw file):

}

builder.Services.AddBugSnag(builder.Configuration);

We don't need our own AddBugSnag method. We can just call:

builder.Services.Configure<Bugsnag.Configuration>(builder.Configuration.GetSection("Bugsnag"));
builder.Services.AddBugSnag();

src/Serval/src/Serval.Shared/Controllers/BugsnagExceptionFilter.cs line 5 at r2 (raw file):

namespace Serval.Shared.Controllers;

public class BugsnagExceptionFilter : ExceptionFilterAttribute

We don't need this. Bugsnag automatically reports unhandled exceptions.


src/Serval/src/Serval.Shared/Controllers/ServalControllerBase.cs line 14 at r2 (raw file):

[TypeFilter(typeof(ForbiddenExceptionFilter))]
[TypeFilter(typeof(BadRequestExceptionFilter))]
public abstract class ServalControllerBase(IAuthorizationService authService, Bugsnag.IClient bugsnagClient)

There is no need to inject the BugSnag client into every controller. We can just inject it where needed.


src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/BugsnagOptions.cs line 3 at r2 (raw file):

namespace SIL.ServiceToolkit.Services;

public class BugsnagOptions

Bugsnag already has a configuration options class.


src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/IServiceCollectionExtensions.cs line 9 at r2 (raw file):

public static class IServiceCollectionExtensions
{
    public static IServiceCollection AddBugSnag(this IServiceCollection services, IConfiguration? configuration = null)

We don't need this. See my comment above.

@johnml1135
Copy link
Collaborator Author

src/Machine/src/Serval.Machine.EngineServer/Program.cs line 32 at r2 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

We don't need our own AddBugSnag method. We can just call:

builder.Services.Configure<Bugsnag.Configuration>(builder.Configuration.GetSection("Bugsnag"));
builder.Services.AddBugSnag();

Done.

@johnml1135
Copy link
Collaborator Author

src/Serval/src/Serval.Shared/Controllers/BugsnagExceptionFilter.cs line 5 at r2 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

We don't need this. Bugsnag automatically reports unhandled exceptions.

I was thinking about the exceptions we handled that I still wanted to log them, but then I released that they are normally bad user behavior (looking for a file that doesn't exist) rather than code error. Updated.

@johnml1135
Copy link
Collaborator Author

src/Serval/src/Serval.Shared/Controllers/ServalControllerBase.cs line 14 at r2 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

There is no need to inject the BugSnag client into every controller. We can just inject it where needed.

Done.

@johnml1135
Copy link
Collaborator Author

src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/BugsnagOptions.cs line 3 at r2 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

Bugsnag already has a configuration options class.

Done.

@johnml1135
Copy link
Collaborator Author

src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/IServiceCollectionExtensions.cs line 9 at r2 (raw file):

Previously, ddaspit (Damien Daspit) wrote…

We don't need this. See my comment above.

Done.

Copy link
Contributor

@ddaspit ddaspit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 16 of 16 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @johnml1135)

@johnml1135 johnml1135 merged commit df6673e into main Sep 12, 2024
3 checks passed
@johnml1135 johnml1135 deleted the bugsnag branch September 12, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants