sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Detect Spring (Boot) version and log a warning if not compatible

Open adinauer opened this issue 1 year ago • 3 comments

Problem Statement

see solution

Solution Brainstorm

Since we offer a separate dependency for Spring 5 vs Spring 6 and Spring Boot 2 vs Spring Boot 3 we could detect the version of Spring (Boot) that's used and compare with intended version of the dependency then log a warning if incompatible.

adinauer avatar Sep 05 '23 07:09 adinauer

I got bitten by this upgrading a project from Spring 2 to Spring 3 and it took a while to track down, I didn't switch to the Jakarta dependency. I was adding sentry.debug=true to try and work out what was wrong but it wasn't changing anything.

Then a co-worker upgraded another project a few months later and ran into exactly the same thing (I'd forgotten about this when reviewing his changes and missed it).

It would be really helpful to fail at build time (not sure this is possible), but otherwise logging a big fat warning at startup time would be really useful. We rely on sentry to reporting errors to us so sadly would probably miss the logged warning once it's no longer on a developers machine.

buckett avatar Feb 16 '24 12:02 buckett

@buckett sorry for the inconvenience, we'll bump prio on this and check what we can do.

adinauer avatar Feb 19 '24 08:02 adinauer

Yeah, hopefully we don't miss it again, it just because often Java upgrades are caught as compile time errors it's easy to fall into the trap of upgrade dependencies and then fix/build/repeat until the application builds and the tests pass.

We don't have any sentry tests (do other people?) so it's easy to miss that the sentry autoconfiguration wasn't getting picked up.

For us the performance data means that we normally spot something is wrong after a short while, but if you're only using Sentry for errors on a small application it might be easy to miss this for a long time.

buckett avatar Feb 19 '24 09:02 buckett