Skip to content

Commit

Permalink
Add Sentry filter event
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Oct 23, 2020
1 parent 8c28f37 commit 1813dba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ dependencies {
'org.apache.httpcomponents:httpclient:4.5.13',
'com.sun.mail:javax.mail:1.6.2',
'com.amazonaws:aws-java-sdk-s3:1.11.886',
'com.adobe.xmp:xmpcore:6.1.10'
'com.adobe.xmp:xmpcore:6.1.10',
'io.sentry:sentry-logback:3.0.0'
)

compile(configurations.metrics) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.sf.jasperreports.engine.fonts.FontFamily;
import net.sf.jasperreports.extensions.ExtensionsEnvironment;
import io.sentry.Sentry;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.jfree.util.Log;
Expand Down Expand Up @@ -216,6 +217,21 @@ public MapPrinterServlet(
this.context = context;
this.servletInfo = servletInfo;
this.mapPrinterFactory = mapPrinterFactory;

if (System.getenv().containsKey("SENTRY_URL")) {
Sentry.init(options -> {
options.setBeforeSend(
(event, hint) -> {
if (event.getLogger() == "org.hibernate.engine.jdbc.spi.SqlExceptionHelper"
&& (event.getMessage().toString() == "ERROR: could not obtain lock on row in relation \"print_job_statuses\""
|| event.getMessage().toString() == "SQL Error: 0, SQLState: 55P03")) {
return null;
}
return event;
}
);
});
}
}

/**
Expand Down

0 comments on commit 1813dba

Please sign in to comment.