$30 off During Our Annual Pro Sale. View Details »

Troubleshooting Spring Boot Applications with Sentry

Troubleshooting Spring Boot Applications with Sentry

No matter how clean our code is, how good our tests are, how well our infrastructure scales - one day, eventually something will go wrong in production. Bugs and outages cases customer to lose trust and cost real money. Our job is to identify and fix the issue as quickly as possible. In this session, we will have a look at Sentry - an open source troubleshooting and application monitoring solution - and its seamless integration with Spring Boot. We will learn the benefits of treating errors as contextual events and how exception reporting and performance monitoring in a single tool simplify addressing production issues.

Talk given at JavaCRO 2021 https://2021.javacro.hr/eng/Program/Troubleshooting-Spring-Boot-applications-with-Sentry

Code: https://github.com/maciejwalkowiak/troubleshooting-spring-boot-appplications-with-sentry

Maciej Walkowiak

October 11, 2021
Tweet

More Decks by Maciej Walkowiak

Other Decks in Programming

Transcript

  1. MACIEJWALKOWIAK
    TROUBLESHOOTING
    SPRING BOOT APPS
    WITH SENTRY
    MACIEJ
    WALKOWIAK

    View Slide

  2. @maciejwalkowiak
    MAKING SOFTWARE IN 2021 LIKE A PRO
    •Agile
    •Unit & Integration Tests
    •Frequent Releases
    •Cloud
    •Deployment Automation

    View Slide

  3. @maciejwalkowiak
    DEVELOPER LIFE IN 2007
    •Agile Waterfall
    •Unit & Integration Tests Manual Testing
    •Frequent Releases Release every few months
    •Cloud Server Room behind the wall
    •Deployment Automation Sending ZIP file to release
    manager

    View Slide

  4. @maciejwalkowiak
    If something can go wrong,
    It will go wrong

    View Slide

  5. MACIEJWALKOWIAK

    View Slide

  6. MACIEJWALKOWIAK
    return paymentService.executePayment(userId, payment);

    View Slide

  7. MACIEJWALKOWIAK
    try {
    return paymentService.executePayment(userId, payment);
    } catch (Exception e) {
    LOGGER.error("Executing payment failed for user: {}, payment: {}", e);
    throw new RuntimeException(e);
    }

    View Slide

  8. MACIEJWALKOWIAK
    try {
    LOGGER.info("Executing payment for user: {}", userId);
    PaymentResult result = paymentService.executePayment(userId, payment);
    LOGGER.info("Payment result: {}", result);
    return result;
    } catch (Exception e) {
    LOGGER.error("Executing payment failed for user: {}, payment: {}", e);
    throw new RuntimeException(e);
    }

    View Slide

  9. @maciejwalkowiak
    THINGS HAVE CHANGED
    •(Misunderstood) Agile
    •Cloud & Microservices
    •Mobile (traffic!)
    •(Proper) security

    View Slide

  10. MACIEJWALKOWIAK

    View Slide

  11. @maciejwalkowiak
    hey I just met you
    and this is crazy
    but can this error log
    be a bug report maybe?

    View Slide

  12. MACIEJWALKOWIAK

    View Slide

  13. MACIEJWALKOWIAK
    MACIEJ WALKOWIAK
    - independent consultant
    - Spring Cloud AWS Lead
    - working with

    View Slide

  14. @maciejwalkowiak
    DEMO TIME!

    View Slide

  15. @maciejwalkowiak
    SENTRY & SPRING BOOT INTEGRATIONS
    •Spring MVC
    •Spring WebFlux (error reporting)
    •Retrieving user information from Spring Security
    •RestTemplate
    •WebClient
    •Logback
    •declarative tracing with @SentrySpan & @SentryTransaction

    View Slide

  16. @maciejwalkowiak
    OTHER INTEGRATIONS
    •OpenFeign
    •Apollo GraphQL
    •Java Util Logging
    •Log4j2
    •Servlets

    View Slide

  17. MACIEJWALKOWIAK
    https://sentry.io

    View Slide

  18. MACIEJWALKOWIAK
    https://github.com/getsentry

    View Slide

  19. MACIEJWALKOWIAK
    https://docs.sentry.io

    View Slide

  20. MACIEJWALKOWIAK
    https://github.com/getsentry/sentry-java

    View Slide

  21. @maciejwalkowiak
    THANK YOU!
    HAPPY BUGFIXING!

    View Slide