-
-
Notifications
You must be signed in to change notification settings - Fork 475
feat(otel): Add OpenTelemetry compatibility BOM #5629
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
Draft
adinauer
wants to merge
2
commits into
main
Choose a base branch
from
feat/opentelemetry-bom
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # sentry-opentelemetry-bom | ||
|
|
||
| This BOM aligns Sentry OpenTelemetry modules with the OpenTelemetry artifacts tested by Sentry. | ||
|
|
||
| Use this BOM only when you want Sentry to manage OpenTelemetry dependency versions for Sentry's OpenTelemetry integrations. Do not import it for regular Sentry usage unless you also want this OpenTelemetry version alignment. | ||
|
|
||
| The BOM intentionally manages stable and `-alpha` OpenTelemetry artifacts, including incubator artifacts used by the OpenTelemetry instrumentation stack. It makes Sentry's tested OpenTelemetry versions authoritative, so verify dependency resolution before importing it if your application already uses newer OpenTelemetry versions. | ||
|
|
||
| This BOM is primarily for classpath-based OpenTelemetry integrations such as `sentry-opentelemetry-agentless`, `sentry-opentelemetry-agentless-spring`, `sentry-opentelemetry-otlp`, and `sentry-opentelemetry-otlp-spring`. It does not change the OpenTelemetry dependencies shaded into the `sentry-opentelemetry-agent` Java agent JAR. | ||
|
|
||
| ## Dependency management ordering | ||
|
|
||
| Ordering matters when another BOM, such as Spring Boot's dependency management, also manages OpenTelemetry versions. | ||
|
|
||
| ### Gradle | ||
|
|
||
| When using Gradle with the Spring dependency management plugin, the last imported BOM wins. Import this BOM after Spring Boot's dependency management so its OpenTelemetry versions take precedence: | ||
|
|
||
| ```kotlin | ||
| dependencyManagement { | ||
| imports { | ||
| mavenBom("org.springframework.boot:spring-boot-dependencies:<spring-boot-version>") | ||
| mavenBom("io.sentry:sentry-opentelemetry-bom:<sentry-version>") | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| If the Spring Boot Gradle plugin imports Spring Boot dependency management implicitly, add the Sentry BOM in your `dependencyManagement` block; explicit imports are applied after the implicit Spring Boot import. | ||
|
|
||
| ### Maven | ||
|
|
||
| Maven uses different precedence rules: when multiple BOMs are imported in the same `<dependencyManagement>` block, the first declaration wins. | ||
|
|
||
| When using `spring-boot-starter-parent`, declare `sentry-opentelemetry-bom` in the child POM's `<dependencyManagement>` block. Dependency management in the child POM takes precedence over the parent: | ||
|
|
||
| ```xml | ||
| <dependencyManagement> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.sentry</groupId> | ||
| <artifactId>sentry-opentelemetry-bom</artifactId> | ||
| <version>${sentry.version}</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </dependencyManagement> | ||
| ``` | ||
|
|
||
| When importing `spring-boot-dependencies` manually in the same POM, import `sentry-opentelemetry-bom` first so Sentry's OpenTelemetry versions win: | ||
|
|
||
| ```xml | ||
| <dependencyManagement> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>io.sentry</groupId> | ||
| <artifactId>sentry-opentelemetry-bom</artifactId> | ||
| <version>${sentry.version}</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-dependencies</artifactId> | ||
| <version>${spring-boot.version}</version> | ||
| <type>pom</type> | ||
| <scope>import</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </dependencyManagement> | ||
| ``` |
34 changes: 34 additions & 0 deletions
34
sentry-opentelemetry/sentry-opentelemetry-bom/build.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| plugins { | ||
| `java-platform` | ||
| `maven-publish` | ||
| } | ||
|
|
||
| javaPlatform.allowDependencies() | ||
|
|
||
| dependencies { | ||
| api(platform(libs.otel.bom)) | ||
| api(platform(libs.otel.alpha.bom)) | ||
| api(platform(libs.otel.instrumentation.bom)) | ||
| api(platform(libs.otel.instrumentation.alpha.bom)) | ||
|
|
||
| constraints { | ||
| project.rootProject.subprojects | ||
| .filter { | ||
| it.path.startsWith(":sentry-opentelemetry:") && | ||
| it.name != project.name && | ||
| !it.name.contains("test", ignoreCase = true) | ||
| } | ||
| .forEach { project -> | ||
| evaluationDependsOn(project.path) | ||
| project.publishing.publications | ||
| .mapNotNull { it as? MavenPublication } | ||
| .filter { | ||
| !it.artifactId.endsWith("-kotlinMultiplatform") && !it.artifactId.endsWith("-metadata") | ||
| } | ||
| .forEach { | ||
| val dependency = "${it.groupId}:${it.artifactId}:${it.version}" | ||
| api(dependency) | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Reaching across projects is a bad practice and is incompatible with IsolatedProjects is there another way to do this or can we just manually declare the projects?
evaluationDependsOnis bad for build performance