-
Notifications
You must be signed in to change notification settings - Fork 124
feat: Add OpenTelemetry migration recipes for Spring Boot applications #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/main/java/org/openrewrite/java/spring/opentelemetry/MigrateSleuthToMicrometerTracing.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/opentelemetry/package-info.java
Outdated
Show resolved
Hide resolved
|
Great to see @sandy2008 ! I'll try to get a proper review & merge in before the release tomorrow. |
src/main/java/org/openrewrite/java/spring/opentelemetry/MigrateSleuthToMicrometerTracing.java
Outdated
Show resolved
Hide resolved
|
|
||
| --- | ||
| type: specs.openrewrite.org/v1beta/recipe | ||
| name: org.openrewrite.java.spring.boot3.OpenTelemetryCompleteMigration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this recipe be included in any larger composite such as a particular Spring Boot version migration? I'm not sure at which point it might have become a required migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I added This is an optional migration for users who want to adopt OpenTelemetry as their observability solution. It is not included in standard Spring Boot version migrations because those use Micrometer Tracing (which can work with either Brave or OpenTelemetry as a backend). Use this recipe if you want to fully embrace OpenTelemetry's native instrumentation and exporters.
Since Sleuth → Micrometer Tracing + Brave is already in UpgradeSpringBoot_3_0, is it better to make it optional..?
timtebeek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a couple quick questions pop up during the initial reading; would be good to get clarity on those before we continue.
…acing to Micrometer and OpenTelemetry
@timtebeek Thank you for reviewing.. fixed those mistakes! |
src/main/java/org/openrewrite/java/spring/opentelemetry/MigrateSleuthToMicrometerTracing.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/opentelemetry/package-info.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/opentelemetry/MigrateDatadogToOpenTelemetry.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/opentelemetry/MigrateOpenTracingToOpenTelemetry.java
Outdated
Show resolved
Hide resolved
|
@timtebeek Hi! I replaced w/ yml recipes & tested. |
What's changed?
Add comprehensive OpenTelemetry migration recipes to help Spring Boot applications migrate from legacy tracing solutions to OpenTelemetry.
New YAML Recipes (
opentelemetry.yml):AddOpenTelemetryAutoInstrumentation- Add OpenTelemetry auto-instrumentation withopentelemetry-spring-boot-starterMigrateToOpenTelemetryFromSleuth- Migrate from Spring Cloud Sleuth to OpenTelemetryMigrateBraveToOpenTelemetry,MigrateFromZipkinToOpenTelemetry- Migrate from Brave/ZipkinConfigureOpenTelemetryForSpringBoot- Configure OTLP exporter and service nameOpenTelemetryCompleteMigration- Complete end-to-end migration recipeMigrateSleuthToMicrometerTracing- Migrate Spring Cloud Sleuth API types to Micrometer TracingMigrateSleuthAnnotationsToOpenTelemetry- Migrate@NewSpan,@SpanTag,@ContinueSpanto@WithSpan,@SpanAttributeMigrateOpenTracingToOpenTelemetry- Migrate OpenTracing API to OpenTelemetry APIMigrateDatadogToOpenTelemetry- Migrate Datadog tracing API and@Traceannotation to OpenTelemetryWhat's your motivation?
OpenTelemetry has become the industry standard for observability. Spring Cloud Sleuth is deprecated in favor of Micrometer Tracing, and many organizations are migrating from vendor-specific solutions (Datadog, Zipkin, Brave) to OpenTelemetry for vendor-neutral observability.
These recipes automate the migration process, handling:
Anything in particular you'd like reviewers to focus on?
opentelemetry-spring-boot-starterfor zero-code auto-instrumentation approachHave you considered any alternatives or workarounds?
classpathFromResourcesfor tests but useddependsOnwith stub types for better test isolationAddDependency,ChangeType,ChangeSpringPropertyKey) for maintainabilityAny additional context
Uses OpenTelemetry Java Instrumentation 2.23.0 which includes:
@WithSpanand@SpanAttributeannotationsChecklist