openrewrite / rewrite-spring

OpenRewrite recipes for Spring projects.
Apache License 2.0
237 stars 64 forks source link

Migrate `WebMvcTags` to `ServerRequestObservationConvention` #531

Open timtebeek opened 1 month ago

timtebeek commented 1 month ago

What problem are you trying to solve?

WebMvcTags was deprecated in 3.0, for removal in 3.2 in favor of ServerRequestObservationConvention. The 3.0 release notes merely mention:

RestTemplateExchangeTagsProvider, WebClientExchangeTagsProvider, WebFluxTagsProvider, WebMvcTagsProvider and related classes have been replaced with ObservationConvention equivalents.

The before/after of this change is still a bit unclear to me; hoping someone can provide additional samples of how this API was used, and how the replacements should look in 3.2+.

bsmahi commented 1 month ago

Hi @timtebeek

I could find some more information on this topic

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#tag-providers-and-contributors-migration

Hope this helps. I will further explore on it.

Thanks, Mahi

timtebeek commented 1 month ago

Thanks for the helpful link @bsmahi ; looks quite involved at first glance, especially as the methods in DefaultServerRequestObservationConvention are non static, whereas WebMvcTags did have static methods. That might complicate a migration, automated or manual.