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

log 5** exceptions to sentry #58

Merged
merged 5 commits into from
Feb 22, 2024
Merged

log 5** exceptions to sentry #58

merged 5 commits into from
Feb 22, 2024

Conversation

jsotobroad
Copy link
Collaborator

@jsotobroad jsotobroad commented Feb 19, 2024

Description

To satisy the requirement for Production Readiness section M8, we need to send our exceptions to sentry for monitoring puproses. The work was already done to set up our dashboard and make sentry available to us. This PR introduces sentry to the service and logs all 5** exceptions we generate to sentry for monitoring

This change has to go along with https://github.com/broadinstitute/terra-helmfile/pull/5103

Jira Ticket

https://broadworkbench.atlassian.net/browse/TSPS-172

@jsotobroad jsotobroad changed the title hook up sentry to services to log 5** exceptions log 5** exceptions to sentry Feb 19, 2024
Copy link
Collaborator

@mmorgantaylor mmorgantaylor left a comment

Choose a reason for hiding this comment

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

a couple questions for my understanding, but looks good

if (sentryConfiguration.dsn().isEmpty()) {
logger.info("No Sentry DSN found. Starting up without it.");
} else {
logger.info("Sentry DSN found. 5xx errors will be sent to Sentry.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice, i really like these logs.

@@ -128,9 +129,14 @@ public ResponseEntity<ApiErrorReport> catchallHandler(Exception ex) {

private ResponseEntity<ApiErrorReport> buildApiErrorReport(
@NotNull Throwable ex, HttpStatus statusCode, List<String> causes) {
// only logging 5** errors to sentry, should we log more/every error? Other services seem to do
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: we can probably remove the question here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup yup this was for you to see it :). will remove

@@ -11,7 +11,9 @@
@SpringBootTest(
properties = {
"spring.main.lazy-initialization=true",
"datasource.testWithEmbeddedDatabase=false"
"datasource.testWithEmbeddedDatabase=false",
"pipelines.sentry.dsn=" // piggyback on this test which already supplies properties to test
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we can chat about this - how did you decide on this test class to add this to?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i just chose a test that overwrote some properties in the test assplication.conf. I didnt feel like it was worth creating a whole new class to test this (i would rather remove it and not test than do that).

@@ -48,3 +48,6 @@ cbas:
pipelines:
ingress:
domainName: "some-tsps-domain.com"
sentry:
dsn: https://public@sentry.example.com/1
Copy link
Collaborator

Choose a reason for hiding this comment

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

do these get used anywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

they get used when sentry is instantiated i.e. it has to look like this pattern otherwise it'll throw an exception

Copy link

sonarcloud bot commented Feb 22, 2024

@jsotobroad jsotobroad merged commit 0d66d79 into main Feb 22, 2024
13 checks passed
@jsotobroad jsotobroad deleted the js_TSPS-172 branch February 22, 2024 19:31
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.

2 participants