Migrate Spring Cloud Sleuth 3.1 to Micrometer Tracing 1.0
org.openrewrite.java.spring.cloud2022.MigrateCloudSleuthToMicrometerTracing
Spring Cloud Sleuth has been discontinued and only compatible with Spring Boot 2.x.
Tags
spring
cloud
tracing
sleuth
micrometer
Recipe source
GitHub, Issue Tracker, Maven Central
groupId: org.openrewrite.recipe
artifactId: rewrite-spring
version: 5.8.0
This recipe is composed of more than one recipe. If you want to customize the set of recipes this is composed of, you can find and copy the GitHub source for the recipe from the link above.
Usage
This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-spring:5.8.0
in your build file or by running a shell command (in which case no build changes are needed):
Add the following to your
build.gradle
file:
Run
gradle rewriteRun
to run the recipe.
Definition
oldGroupId:
org.springframework.cloud
oldArtifactId:
spring-cloud-starter-sleuth
newGroupId:
io.micrometer
newArtifactId:
micrometer-tracing-bridge-brave
newVersion:
1.0.x
oldGroupId:
org.springframework.cloud
oldArtifactId:
spring-cloud-sleuth-otel-dependencies
newGroupId:
io.micrometer
newArtifactId:
micrometer-tracing-bridge-otel
newVersion:
1.0.x
oldGroupId:
org.springframework.cloud
oldArtifactId:
spring-cloud-sleuth-api
newGroupId:
io.micrometer
newArtifactId:
micrometer-tracing
newVersion:
1.0.x
oldGroupId:
org.springframework.cloud
oldArtifactId:
spring-cloud-sleuth-autoconfigure
newGroupId:
org.springframework.boot
newArtifactId:
spring-boot-actuator-autoconfigure
oldGroupId:
org.springframework.cloud
oldArtifactId:
spring-cloud-sleuth-otel-autoconfigure
newGroupId:
org.springframework.boot
newArtifactId:
spring-boot-actuator-autoconfigure
oldGroupId:
org.springframework.cloud
oldArtifactId:
spring-cloud-sleuth-zipkin
newGroupId:
io.zipkin.reporter2
newArtifactId:
zipkin-reporter-brave
newVersion:
2.16.x
Add Gradle or Maven dependency
groupId:
org.springframework.boot
artifactId:
spring-boot-starter-actuator
version:
3.0.x
onlyIfUsing:
org.springframework.cloud.sleuth..*
acceptTransitive:
true
Add Gradle or Maven dependency
groupId:
io.micrometer
artifactId:
micrometer-tracing
version:
1.0.x
onlyIfUsing:
org.springframework.cloud.sleuth.annotation.*
acceptTransitive:
true
Add Gradle or Maven dependency
groupId:
org.springframework.boot
artifactId:
spring-boot-starter-aop
version:
3.0.x
onlyIfUsing:
org.springframework.cloud.sleuth.annotation.*
acceptTransitive:
true
Remove a Gradle or Maven dependency
groupId:
org.springframework.cloud
artifactId:
spring-cloud-sleuth-*
Remove Maven managed dependency
groupId:
org.springframework.cloud
artifactId:
spring-cloud-sleuth-*
Remove redundant explicit dependency and plugin versions
groupPattern:
io.micrometer
artifactPattern:
micrometer-tracing*
onlyIfVersionsMatch:
false
oldFullyQualifiedTypeName:
org.springframework.cloud.sleuth.exporter.SpanFilter
newFullyQualifiedTypeName:
io.micrometer.tracing.exporter.SpanExportingPredicate
oldFullyQualifiedTypeName:
org.springframework.cloud.sleuth.exporter.SpanIgnoringSpanFilter
newFullyQualifiedTypeName:
io.micrometer.tracing.exporter.SpanIgnoringSpanExportingPredicate
oldPackageName:
org.springframework.cloud.sleuth.autoconfig
newPackageName:
org.springframework.boot.actuate.autoconfigure.tracing
recursive:
true
oldPackageName:
org.springframework.cloud.sleuth
newPackageName:
io.micrometer.tracing
recursive:
true
Change the key of a spring application property
oldPropertyKey:
spring.sleuth.enabled
newPropertyKey:
management.tracing.enabled
Change the key of a spring application property
oldPropertyKey:
spring.sleuth.batch.enabled
newPropertyKey:
management.tracing.enabled
Delete a spring configuration property
propertyKey:
spring.sleuth.supports-join
Delete a spring configuration property
propertyKey:
spring.sleuth.trace-id128
Change the key of a spring application property
oldPropertyKey:
spring.sleuth.propagation.type
newPropertyKey:
management.tracing.propagation.type
Delete a spring configuration property
propertyKey:
spring.sleuth.sampler.rate
Change the key of a spring application property
oldPropertyKey:
spring.sleuth.sampler.probability
newPropertyKey:
management.tracing.sampling.probability
Change the key of a spring application property
oldPropertyKey:
spring.sleuth.baggage.remote-fields
newPropertyKey:
management.tracing.baggage.remote-fields
Change the key of a spring application property
oldPropertyKey:
spring.sleuth.propagation-keys
newPropertyKey:
management.tracing.baggage.remote-fields
Change the key of a spring application property
oldPropertyKey:
spring.sleuth.baggage.correlation-enabled
newPropertyKey:
management.tracing.baggage.correlation.enabled
Change the key of a spring application property
oldPropertyKey:
spring.sleuth.baggage.correlation-fields
newPropertyKey:
management.tracing.baggage.correlation.fields
See how this recipe works across multiple open-source repositories
The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.
Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.
Contributors
Tyler Van Gorder, Knut Wannheden, Nick McKinney, Patrick, Tim te Beek, Kun Li, Jonathan Schnéider, Kyle Scully
Last updated