Migrate from Spring Cloud Sleuth to OpenTelemetry

MSAL

Migrate from Spring Cloud Sleuth to OpenTelemetry. Spring Cloud Sleuth has been deprecated and is replaced by Micrometer Tracing with OpenTelemetry as a backend. This recipe removes Sleuth dependencies and adds OpenTelemetry instrumentation.

org.openrewrite.java.spring.opentelemetry.MigrateSleuthToOpenTelemetry
mod run . --recipe=org.openrewrite.java.spring.opentelemetry.MigrateSleuthToOpenTelemetry

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Remove a Gradle or Maven dependency org.springframework.cloud:spring-cloud-starter-sleuth
  2. Remove a Gradle or Maven dependency org.springframework.cloud:spring-cloud-sleuth*
  3. Add Gradle or Maven dependency io.micrometer:micrometer-tracing-bridge-otel:1.x
  4. Add Gradle or Maven dependency io.opentelemetry:opentelemetry-exporter-otlp:1.x
  5. Add Gradle or Maven dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:2.x
  6. Add Gradle or Maven dependency io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter:2.x
  7. Add Gradle or Maven dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations:2.x
  8. Add Gradle or Maven dependency org.springframework.boot:spring-boot-starter-aop:3.x
  9. Change the key of a Spring application property
  10. Change the key of a Spring application property
  11. Change the key of a Spring application property
  12. Change the key of a Spring application property
  13. Change the key of a Spring application property
  14. Change the key of a Spring application property
  15. Change the key of a Spring application property
  16. Delete a Spring configuration property spring.sleuth.otel.config.trace-id-ratio-based
  17. Delete a Spring configuration property spring.sleuth.otel.resource.enabled
  18. Change type SpanFilter to SpanExportingPredicate
  19. Change type NewSpan to WithSpan
  20. Change type SpanTag to SpanAttribute
  21. Change type ContinueSpan to WithSpan
  22. Rename package name org.springframework.cloud.sleuth to io.micrometer.tracing