Spring Boot + Sentry: Error Monitoring

Spring Boot + Sentry: Error Monitoring

In this article, you are going to learn the integration of Spring boot and sentry.

What us Sentry:

Self-hosted and cloud-based application monitoring that helps software teams see clearer, solve quicker, & learn continuously. Sentry is help developers from error tracking to performance monitoring, and developers can see what actually matters, solve quicker, and learn continuously about their applications - from the frontend to the backend.

To learn more click here Sentry.

In production, there are some exceptions or error that occurs but it's easy to understand finding the root cause and tracing out that bug or exception is really a skillful job. When your customers are using the application and found that application issue, How do you get to know about that problem so you can fix the problem before customers start to complain about the application?

You can start using sentry by simply signing up to the platform sentry.io and creating a new application. after creating your application, Sentry will give you the app id which is DSN.

image.png

In order to integrate sentry in your spring boot, all you need to do is add its dependency in your build.gradle and add some properties in your application.yml file.

Add the following dependency in your build.gradle.

implementation 'io.sentry:sentry-spring-boot-starter:6.0.0'

For Maven users:

<dependency>
    <groupId>io.sentry</groupId>
    <artifactId>sentry-spring-boot-starter</artifactId>
    <version>6.0.0</version>
</dependency>

Sentry supports Spring Boot 2.1.0 and above to report unhandled exceptions.

Then add your sentry DSN in your application property file.

sentry.dsn=https://exampleSomePublicKey@o0.ingest.sentry.io/0

To do the validation of integration with the sentry. just throw a new exception from your application code.

throw new SentryDemoException("This is a Validation Exception.");

Go to your sentry dashboard and you are able to see the exception.

Sentry is free to use for personal use.

Sentry is easily giving all the insights on the dashboard and it also supports integration with other platforms like Slack, and Squadcast so that your team can be notified.

Conclusion:

In this article, you learned the integration of sentry and spring boot in easy steps. It's free for personal use. The good thing about sentry is, that it is providing a wide range of tools to integrate with a different platform so that your team gets notified and takes quick action.

Reference Document:

docs.sentry.io/platforms/java/guides/spring.. sentry.io/signup

More such articles:

https://medium.com/techwasti

https://www.youtube.com/channel/UCiTaHm1AYqMS4F4L9zyO7qA

https://www.techwasti.com/

==========================**=========================

If this article adds any value for you then please clap and comment.

Let’s connect on Stackoverflow, LinkedIn, & Twitter.

Did you find this article valuable?

Support techwasti by becoming a sponsor. Any amount is appreciated!